test.command.executableSubcommand.signals.int.js
This file
Path
test/test.command.executableSubcommand.signals.int.js
22 lines · 539 bytes · JavaScript
Last changed by
feature: support for signals to subcommands (#632)Thomas Simoensbefore adoption1e4c689
History of this fileTake it
feature: support for signals to subcommands (#632)Thomas Simoensbefore adoption1e4c689
lines 1–22why, one step back1var spawn = require('child_process').spawn,2 path = require('path'),3 should = require('should');45var bin = path.join(__dirname, './fixtures/pm');6var proc = spawn(bin, ['listen'], {});78var output = '';9proc.stdout.on('data', function (data) {10 output += data.toString();11});1213// Set a timeout to give 'proc' time to setup completely14setTimeout(function () {15 proc.kill('SIGINT');1617 // Set another timeout to give 'prog' time to handle the signal18 setTimeout(function() {19 output.should.equal('SIGINT\n');20 }, 1000);2122}, 2000);