From 3b7a9a2589a55f3c4cb9abc2162351b22aec6973 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 13 Sep 2017 00:22:45 -0400 Subject: [PATCH] child_process: add windowsHide option This commit exposes the UV_PROCESS_WINDOWS_HIDE flag in Node as a windowsHide option to the child_process methods. The option is only applicable to Windows, and is ignored elsewhere. Fixes: https://github.com/nodejs/node/issues/15217 PR-URL: https://github.com/nodejs/node/pull/15380 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- doc/api/child_process.md | 32 ++++++++++++ lib/child_process.js | 8 +++ src/env.h | 1 + src/process_wrap.cc | 7 +++ src/spawn_sync.cc | 5 ++ .../test-child-process-spawnsync-shell.js | 1 + ...ild-process-spawnsync-validation-errors.js | 16 ++++++ .../test-child-process-windows-hide.js | 52 +++++++++++++++++++ 8 files changed, 122 insertions(+) create mode 100644 test/parallel/test-child-process-windows-hide.js diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 32c9c4f0612113..02f3201f2b8693 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -127,6 +127,10 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => { ### child_process.exec(command[, options][, callback]) * `command` {string} The command to run, with space-separated arguments. @@ -145,6 +149,8 @@ added: v0.1.90 * `killSignal` {string|integer} **Default:** `'SIGTERM'` * `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`. * `callback` {Function} called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} @@ -238,6 +244,10 @@ lsExample(); ### child_process.execFile(file[, args][, options][, callback]) * `file` {string} The name or path of the executable file to run. @@ -253,6 +263,8 @@ added: v0.1.91 * `killSignal` {string|integer} **Default:** `'SIGTERM'` * `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`. * `callback` {Function} Called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} @@ -364,6 +376,9 @@ supported by `child_process.fork()` and will be ignored if set.