Modify handling of SIGINT in balena-dev

Change-type: patch
Signed-off-by: Scott Lowe <scott@balena.io>
This commit is contained in:
Scott Lowe 2020-12-16 13:03:14 +01:00
parent da652c6bce
commit 5c93df921e

View File

@ -21,9 +21,14 @@ modifyOclifPaths();
process.on('exit', function () { process.on('exit', function () {
modifyOclifPaths(true); modifyOclifPaths(true);
}); });
// Undo changes in case of ctrl-v // Undo changes in case of ctrl-c
process.on('SIGINT', function () { process.on('SIGINT', function () {
modifyOclifPaths(true); modifyOclifPaths(true);
// Note process exit here will interfere with commands that do their own SIGINT handling,
// but without it commands can not be exited.
// So currently using balena-dev does not guarantee proper exit behaviour when using ctrl-c.
// Ideally a better solution is needed.
process.exit();
}); });
// Use fast-boot to cache require lookups, speeding up startup // Use fast-boot to cache require lookups, speeding up startup