From 95a20d45d4af05eace9693a346e45d8bc9eabc2c Mon Sep 17 00:00:00 2001 From: hdmr14 <58992133+hdmr14@users.noreply.github.com> Date: Wed, 21 Oct 2020 03:48:17 +0900 Subject: [PATCH] fix(cli): Exit CLI with 1(as failed) when received SIGINT (#736) * fix: Exit process as failed when catch SIGINT. * Exit on SIGINT with correct POSIX value Co-authored-by: David Welch --- bin/git-cz.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/git-cz.js b/bin/git-cz.js index af58adb8..94e2076c 100644 --- a/bin/git-cz.js +++ b/bin/git-cz.js @@ -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, '../')