From b525d776765620815ffb881cfcb9781a83c80479 Mon Sep 17 00:00:00 2001 From: Mike Craig Date: Fri, 20 Oct 2017 21:37:20 -0700 Subject: [PATCH] kill child process on SIGTERM, fixes #88 --- cli.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli.js b/cli.js index 513bc48..0d5bf2d 100755 --- a/cli.js +++ b/cli.js @@ -14,8 +14,11 @@ var input = process.argv.slice(2); var bin = require('./'); if (bin !== null) { - spawn(bin, input, {stdio: 'inherit'}) + var child = spawn(bin, input, {stdio: 'inherit'}) .on('exit', process.exit); + process.on('SIGTERM', function() { + child.kill(); + }); } else { throw new Error('Platform not supported.'); }