Skip to content

Commit

Permalink
set windowsHide: true when spawning a process
Browse files Browse the repository at this point in the history
Summary:
This appears to be necessary to prevent console windows from
opening on Windows when spawning a command when using
the Node JS module for Watchman.

As per https://nodejs.org/api/child_process.html#child_processspawncommand-args-options:

> `windowsHide` <boolean> Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`.

Also, `execa` is a well-known module that attempts to "clean up"
the default `child_process` API, and it sets `windowsHide: true` by default:

https://github.com/sindresorhus/execa/blob/7a8f5cd3e900416a158d0e1b47dceaf6983862ac/index.js#L46

Incidentally, it appears that `windowsHide: true` prevents `SIGINT` from
working on the process:

nodejs/node#29837

Though I do not believe that should cause a problem here?

Reviewed By: fanzeyi

Differential Revision: D39699120

fbshipit-source-id: 82704d997b3c32774f99d19c801535044c121608
  • Loading branch information
bolinfest authored and facebook-github-bot committed Sep 21, 2022
1 parent 2fa79ef commit 5a5c364
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion watchman/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ Client.prototype.connect = function() {

try {
proc = childProcess.spawn(this.watchmanBinaryPath, args, {
stdio: ['ignore', 'pipe', 'pipe']
stdio: ['ignore', 'pipe', 'pipe'],
windowsHide: true
});
} catch (error) {
spawnError(error);
Expand Down

0 comments on commit 5a5c364

Please sign in to comment.