summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-fork-no-shell.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-09-11 20:52:10 -0400
committercjihrig <cjihrig@gmail.com>2017-09-13 21:05:32 -0400
commit688765a3c97378da473db7517e39d8c1dd2fea1c (patch)
tree9abcb6595e2ba9a38d178c4c336d214a7e118e0a /test/parallel/test-child-process-fork-no-shell.js
parented2f347f27f78102f4fba0e61b93f9096eb7e33d (diff)
downloadandroid-node-v8-688765a3c97378da473db7517e39d8c1dd2fea1c.tar.gz
android-node-v8-688765a3c97378da473db7517e39d8c1dd2fea1c.tar.bz2
android-node-v8-688765a3c97378da473db7517e39d8c1dd2fea1c.zip
test: add test for fork() + shell
This commit verifies that the child_process fork() method does not honor the shell option. Refs: https://github.com/nodejs/node/pull/15299 PR-URL: https://github.com/nodejs/node/pull/15352 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'test/parallel/test-child-process-fork-no-shell.js')
-rw-r--r--test/parallel/test-child-process-fork-no-shell.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/parallel/test-child-process-fork-no-shell.js b/test/parallel/test-child-process-fork-no-shell.js
new file mode 100644
index 0000000000..7a085913fb
--- /dev/null
+++ b/test/parallel/test-child-process-fork-no-shell.js
@@ -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);
+}