mirror of https://github.com/lukechilds/node.git
Browse Source
The default signal-handler should be restored if no handlers are assigned.v0.7.4-release
committed by
Ryan Dahl
2 changed files with 37 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||
function tmp() {} |
|||
process.addListener("SIGINT", tmp); |
|||
process.removeListener("SIGINT", tmp); |
|||
setInterval(function () { |
|||
process.stdout.write('keep alive\n'); |
|||
}, 1000); |
@ -0,0 +1,31 @@ |
|||
require("../common"); |
|||
|
|||
var childKilled = false, done = false, |
|||
spawn = require('child_process').spawn, |
|||
sys = require("sys"), |
|||
child; |
|||
|
|||
var join = require('path').join; |
|||
|
|||
child = spawn(process.argv[0], [join(fixturesDir, 'should_exit.js')]); |
|||
child.addListener('exit', function () { |
|||
if (!done) childKilled = true; |
|||
}); |
|||
|
|||
setTimeout(function () { |
|||
sys.puts("Sending SIGINT"); |
|||
child.kill("SIGINT"); |
|||
setTimeout(function () { |
|||
sys.puts("Chance has been given to die"); |
|||
done = true; |
|||
if (!childKilled) { |
|||
// Cleanup
|
|||
sys.puts("Child did not die on SIGINT, sending SIGTERM"); |
|||
child.kill("SIGTERM"); |
|||
} |
|||
}, 200); |
|||
}, 200); |
|||
|
|||
process.addListener("exit", function () { |
|||
assert.ok(childKilled); |
|||
}); |
Loading…
Reference in new issue