Skip to content

Commit

Permalink
child_process: change windowsHide default to true
Browse files Browse the repository at this point in the history
This is likely the default that more Windows users are
expecting.

PR-URL: #21316
Refs: libuv/libuv#1878
Refs: #21314
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
cjihrig committed Jun 20, 2018
1 parent 99e6ecb commit 420d8af
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
30 changes: 24 additions & 6 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => {
<!-- YAML
added: v0.1.90
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v8.8.0
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
Expand All @@ -153,7 +156,7 @@ changes:
* `uid` {number} Sets the user identity of the process (see setuid(2)).
* `gid` {number} Sets the group identity of the process (see setgid(2)).
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.
* `callback` {Function} called with the output when process terminates.
* `error` {Error}
* `stdout` {string|Buffer}
Expand Down Expand Up @@ -232,6 +235,9 @@ lsExample();
<!-- YAML
added: v0.1.91
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v8.8.0
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
Expand All @@ -251,7 +257,7 @@ changes:
* `uid` {number} Sets the user identity of the process (see setuid(2)).
* `gid` {number} Sets the group identity of the process (see setgid(2)).
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.
* `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is
done on Windows. Ignored on Unix. **Default:** `false`.
* `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
Expand Down Expand Up @@ -375,6 +381,9 @@ The `shell` option available in [`child_process.spawn()`][] is not supported by
<!-- YAML
added: v0.1.90
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v8.8.0
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
Expand Down Expand Up @@ -408,7 +417,7 @@ changes:
done on Windows. Ignored on Unix. This is set to `true` automatically
when `shell` is specified. **Default:** `false`.
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.
* Returns: {ChildProcess}

The `child_process.spawn()` method spawns a new process using the given
Expand Down Expand Up @@ -669,6 +678,9 @@ configuration at startup.
<!-- YAML
added: v0.11.12
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v8.8.0
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
Expand Down Expand Up @@ -702,7 +714,7 @@ changes:
* `encoding` {string} The encoding used for all stdio inputs and outputs.
**Default:** `'buffer'`.
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.
* `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
shell can be specified as a string. See [Shell Requirements][] and
Expand Down Expand Up @@ -731,6 +743,9 @@ arbitrary command execution.**
<!-- YAML
added: v0.11.12
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v8.8.0
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
Expand Down Expand Up @@ -763,7 +778,7 @@ changes:
* `encoding` {string} The encoding used for all stdio inputs and outputs.
**Default:** `'buffer'`.
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.
* Returns: {Buffer|string} The stdout from the command.

The `child_process.execSync()` method is generally identical to
Expand All @@ -785,6 +800,9 @@ metacharacters may be used to trigger arbitrary command execution.**
<!-- YAML
added: v0.11.12
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v8.8.0
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
Expand Down Expand Up @@ -826,7 +844,7 @@ changes:
done on Windows. Ignored on Unix. This is set to `true` automatically
when `shell` is specified. **Default:** `false`.
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.
* Returns: {Object}
* `pid` {number} Pid of the child process.
* `output` {Array} Array of results from stdio output.
Expand Down
5 changes: 4 additions & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ values are `'rr'` and `'none'`.
<!-- YAML
added: v0.7.1
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/21316
description: The `windowsHide` option now defaults to `true`.
- version: v9.5.0
pr-url: https://github.com/nodejs/node/pull/18399
description: The `cwd` option is supported now.
Expand Down Expand Up @@ -732,7 +735,7 @@ changes:
number. By default each worker gets its own port, incremented from the
master's `process.debugPort`.
* `windowsHide` {boolean} Hide the forked processes console window that would
normally be created on Windows systems. **Default:** `false`.
normally be created on Windows systems. **Default:** `true`.

After calling `.setupMaster()` (or `.fork()`) this settings object will contain
the settings, including the default values.
Expand Down
6 changes: 4 additions & 2 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ exports.execFile = function execFile(file /* , args, options, callback */) {
gid: options.gid,
uid: options.uid,
shell: options.shell,
windowsHide: !!options.windowsHide,
windowsHide: options.windowsHide !== false,
windowsVerbatimArguments: !!options.windowsVerbatimArguments
});

Expand Down Expand Up @@ -529,7 +529,7 @@ var spawn = exports.spawn = function spawn(/* file, args, options */) {
file: opts.file,
args: opts.args,
cwd: options.cwd,
windowsHide: !!options.windowsHide,
windowsHide: options.windowsHide !== false,
windowsVerbatimArguments: !!options.windowsVerbatimArguments,
detached: !!options.detached,
envPairs: opts.envPairs,
Expand Down Expand Up @@ -563,6 +563,8 @@ function spawnSync(/* file, args, options */) {

options.stdio = _validateStdio(options.stdio || 'pipe', true).stdio;

options.windowsHide = options.windowsHide !== false;

if (options.input) {
var stdin = options.stdio[0] = util._extend({}, options.stdio[0]);
stdin.input = options.input;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawnsync-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ assert.strictEqual(env.stdout.toString().trim(), 'buzz');
assert.strictEqual(opts.options.shell, shell);
assert.strictEqual(opts.options.file, opts.file);
assert.deepStrictEqual(opts.options.args, opts.args);
assert.strictEqual(opts.options.windowsHide, undefined);
assert.strictEqual(opts.options.windowsHide, true);
assert.strictEqual(opts.options.windowsVerbatimArguments,
windowsVerbatim);
});
Expand Down

0 comments on commit 420d8af

Please sign in to comment.