test.command.executableSubcommand.signals.hup.js
This file
Path
test/test.command.executableSubcommand.signals.hup.js
22 lines · 539 bytes · JavaScript
Last changed by
feature: support for signals to subcommands (#632)Thomas Simoensbefore adoption1e4c689
History of this fileTake it
12345678910111213141516171819202122var spawn = require('child_process').spawn, path = require('path'), should = require('should');
var bin = path.join(__dirname, './fixtures/pm');var proc = spawn(bin, ['listen'], {});
var output = '';proc.stdout.on('data', function (data) { output += data.toString();});
// Set a timeout to give 'proc' time to setup completelysetTimeout(function () { proc.kill('SIGHUP');
// Set another timeout to give 'prog' time to handle the signal setTimeout(function() { output.should.equal('SIGHUP\n'); }, 1000);
}, 2000);