Skip to content

Commit

Permalink
kill child process on SIGTERM, fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
mkscrg committed Oct 25, 2017
1 parent 31e8fe8 commit ae7fed4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}

0 comments on commit ae7fed4

Please sign in to comment.