Skip to content

Commit

Permalink
test: add test for fork() + shell
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
cjihrig authored and MylesBorins committed Nov 21, 2017
1 parent 15ced00 commit 6b05937
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/parallel/test-child-process-fork-no-shell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';
// This test verifies that the shell option is not supported by fork().
const common = require('../common');
const assert = require('assert');
const cp = require('child_process');
const expected = common.isWindows ? '%foo%' : '$foo';

if (process.argv[2] === undefined) {
const child = cp.fork(__filename, [expected], {
shell: true,
env: { foo: 'bar' }
});

child.on('exit', common.mustCall((code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
}));
} else {
assert.strictEqual(process.argv[2], expected);
}

0 comments on commit 6b05937

Please sign in to comment.