xref: /third_party/node/test/parallel/test-child-process-fork-no-shell.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci// This test verifies that the shell option is not supported by fork().
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst cp = require('child_process');
61cb0ef41Sopenharmony_ciconst expected = common.isWindows ? '%foo%' : '$foo';
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciif (process.argv[2] === undefined) {
91cb0ef41Sopenharmony_ci  const child = cp.fork(__filename, [expected], {
101cb0ef41Sopenharmony_ci    shell: true,
111cb0ef41Sopenharmony_ci    env: { ...process.env, foo: 'bar' }
121cb0ef41Sopenharmony_ci  });
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci  child.on('exit', common.mustCall((code, signal) => {
151cb0ef41Sopenharmony_ci    assert.strictEqual(code, 0);
161cb0ef41Sopenharmony_ci    assert.strictEqual(signal, null);
171cb0ef41Sopenharmony_ci  }));
181cb0ef41Sopenharmony_ci} else {
191cb0ef41Sopenharmony_ci  assert.strictEqual(process.argv[2], expected);
201cb0ef41Sopenharmony_ci}
21

Indexes created Thu Nov 07 10:32:03 CST 2024