Skip to content

Commit

Permalink
fix(cli): Exit CLI with 1(as failed) when received SIGINT (#736)
Browse files Browse the repository at this point in the history
* fix: Exit process as failed when catch SIGINT.

* Exit on SIGINT with correct POSIX value

Co-authored-by: David Welch <dmwelch@users.noreply.github.com>
  • Loading branch information
hdmr14 and dmwelch committed Oct 20, 2020
1 parent ba7eeb6 commit 95a20d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/git-cz.js
Expand Up @@ -3,7 +3,14 @@ var path = require('path');
process.on('uncaughtException', function (err) {
console.error(err.message || err);
process.exit(1);
})
});

// catch SIGINT signal
process.stdin.on('data', function (key) {
if (key == '\u0003') {
process.exit(130); // 128 + SIGINT
}
});

require('../dist/cli/git-cz.js').bootstrap({
cliPath: path.join(__dirname, '../')
Expand Down

0 comments on commit 95a20d4

Please sign in to comment.