Skip to content

Commit

Permalink
expect unconditional exit with SIGTERM on Windows
Browse files Browse the repository at this point in the history
Per <https://nodejs.org/api/process.html>, "Sending SIGINT, SIGTERM, and SIGKILL cause the unconditional termination of the target process."  So Node ignores our SIGTERM handler, and the process ends when killed with that signal.
  • Loading branch information
mykmelez committed Jul 3, 2017
1 parent dbf243a commit bfd4bae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/exec-flag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var sw = require('../')
var isWindows = require('../lib/is-windows.js')()

if (process.argv[2] === 'wrapper') {
// note: this should never happen,
Expand Down Expand Up @@ -34,10 +35,14 @@ t.test('wrap a -e invocation', function (t) {
code: code,
signal: signal
}
// Per <https://nodejs.org/api/process.html>, "Sending SIGINT,
// SIGTERM, and SIGKILL cause the unconditional termination
// of the target process." So Node ignores our SIGTERM handler,
// and the process ends when killed with that signal.
var expect = {
out: /^(wtf\n)*ignore!\n(wtf\n)*$/,
out: isWindows ? /^(wtf\n)*$/ : /^(wtf\n)*ignore!\n(wtf\n)*$/,
code: null,
signal: 'SIGKILL'
signal: isWindows ? 'SIGTERM' : 'SIGKILL'
}
t.match(actual, expect)
t.end()
Expand Down

0 comments on commit bfd4bae

Please sign in to comment.