mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
fix(CLI): Fix SIGINT signal handling
This commit is contained in:
parent
b86f8cd715
commit
c5a3f6907a
@ -55,8 +55,11 @@ process.once('uncaughtException', (error) => {
|
||||
});
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
process.once('SIGINT', () => {
|
||||
clearTimeout(keepAliveTimer);
|
||||
// If there's another SIGINT listener (command that works as deamon or reads stdin input)
|
||||
// then let the other listener decide how process will exit
|
||||
const isOtherSigintListener = Boolean(process.listenerCount('SIGINT'));
|
||||
if (
|
||||
commandSchema &&
|
||||
!hasTelemetryBeenReported &&
|
||||
@ -74,7 +77,7 @@ process.on('SIGINT', () => {
|
||||
});
|
||||
storeTelemetryLocally({ ...telemetryPayload, outcome: 'interrupt' });
|
||||
}
|
||||
process.exit(1);
|
||||
if (!isOtherSigintListener) process.exit(130);
|
||||
});
|
||||
|
||||
const processSpanPromise = (async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user