Skip to content

Commit 2c6aa17

Browse files
cjihrigMylesBorins
authored andcommitted
test: add test for fork() + shell
This commit verifies that the child_process fork() method does not honor the shell option. Refs: #15299 PR-URL: #15352 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 8813867 commit 2c6aa17

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
// This test verifies that the shell option is not supported by fork().
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const cp = require('child_process');
6+
const expected = common.isWindows ? '%foo%' : '$foo';
7+
8+
if (process.argv[2] === undefined) {
9+
const child = cp.fork(__filename, [expected], {
10+
shell: true,
11+
env: { foo: 'bar' }
12+
});
13+
14+
child.on('exit', common.mustCall((code, signal) => {
15+
assert.strictEqual(code, 0);
16+
assert.strictEqual(signal, null);
17+
}));
18+
} else {
19+
assert.strictEqual(process.argv[2], expected);
20+
}

0 commit comments

Comments
 (0)