test: fix flaky child-process-exec-kill-throws

Kill the child process with `SIGKILL` to make sure the child process
does not remain alive.

Fixes: https://github.com/nodejs/node/issues/20139

PR-URL: https://github.com/nodejs/node/pull/20213
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Santiago Gimeno 2018-04-22 22:22:25 +02:00 committed by Trivikram Kamat
parent 20612486d9
commit f1d9527534

View File

@ -19,7 +19,8 @@ if (process.argv[2] === 'child') {
};
const cmd = `"${process.execPath}" "${__filename}" child`;
const options = { maxBuffer: 0 };
const options = { maxBuffer: 0, killSignal: 'SIGKILL' };
const child = cp.exec(cmd, options, common.mustCall((err, stdout, stderr) => {
// Verify that if ChildProcess#kill() throws, the error is reported.
assert.strictEqual(err.message, 'mock error', err);