summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-fork-no-shell.js
blob: 168f115b0cbcbf8f6d55398277ab6c7436267949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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: Object.assign({}, process.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);
}