diff options
author | João Reis <reis@janeasystems.com> | 2019-07-16 19:26:53 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-18 14:48:29 -0700 |
commit | 9b772250f10da8c5d2ade7c25ccea6ae2601f854 (patch) | |
tree | 24bad7647eed9667265355c8c207160016d0cf8f /test/parallel/test-child-process-exec-timeout.js | |
parent | d0894773a404b04ffd2a050131e73a5622a591c6 (diff) | |
download | android-node-v8-9b772250f10da8c5d2ade7c25ccea6ae2601f854.tar.gz android-node-v8-9b772250f10da8c5d2ade7c25ccea6ae2601f854.tar.bz2 android-node-v8-9b772250f10da8c5d2ade7c25ccea6ae2601f854.zip |
test,win: cleanup exec-timeout processes
When CMD is used to launch a process and CMD is killed too quickly,
the process can stay behind running in suspended state, never
completing. This only happens in Windows Server 2008R2.
Refs: https://github.com/nodejs/build/issues/1829
PR-URL: https://github.com/nodejs/node/pull/28723
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-child-process-exec-timeout.js')
-rw-r--r-- | test/parallel/test-child-process-exec-timeout.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/parallel/test-child-process-exec-timeout.js b/test/parallel/test-child-process-exec-timeout.js index e08aff9085..343050e063 100644 --- a/test/parallel/test-child-process-exec-timeout.js +++ b/test/parallel/test-child-process-exec-timeout.js @@ -56,3 +56,19 @@ cp.exec(cmd, { timeout: 2 ** 30 }, common.mustCall((err, stdout, stderr) => { assert.strictEqual(stdout.trim(), 'child stdout'); assert.strictEqual(stderr.trim(), 'child stderr'); })); + +// Workaround for Windows Server 2008R2 +// When CMD is used to launch a process and CMD is killed too quickly, the +// process can stay behind running in suspended state, never completing. +if (common.isWindows) { + process.once('beforeExit', () => { + const basename = __filename.replace(/.*[/\\]/g, ''); + cp.execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [ + 'process', + 'where', + `commandline like '%${basename}%child'`, + 'delete', + '/nointeractive' + ]); + }); +} |