From 5a5c364ee24c7a44502bfd22f929fc8f74626bb7 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Wed, 21 Sep 2022 11:47:50 -0700 Subject: [PATCH] set `windowsHide: true` when spawning a process 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` 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: https://github.com/nodejs/node/issues/29837 Though I do not believe that should cause a problem here? Reviewed By: fanzeyi Differential Revision: D39699120 fbshipit-source-id: 82704d997b3c32774f99d19c801535044c121608 --- watchman/node/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/watchman/node/index.js b/watchman/node/index.js index 79a232cdc73e..388bcc699137 100644 --- a/watchman/node/index.js +++ b/watchman/node/index.js @@ -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);