-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
child_process: add windowsHide option #15380
Conversation
// options.windowsHide | ||
Local<String> windows_hide_key = env->windows_hide_string(); | ||
|
||
if (js_options->Get(windows_hide_key)->IsTrue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should ideally use the overload that takes a Local<Context>
but OTOH, all the other options don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis I'll submit a follow up PR to switch all of the options to use the context.
@@ -777,6 +777,11 @@ int SyncProcessRunner::ParseOptions(Local<Value> js_value) { | |||
if (js_options->Get(env()->detached_string())->BooleanValue()) | |||
uv_process_options_.flags |= UV_PROCESS_DETACHED; | |||
|
|||
Local<String> win_hide = env()->windows_hide_string(); | |||
|
|||
if (js_options->Get(win_hide)->BooleanValue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with docs
It looks like the original issue is Unitech/pm2#2182 - console window pops-out when starting Node.js through PM2. Based on #7653 I added This PR does not fix that issue, the console window still pops up with /cc @atrauzzi @vmarchaud |
@bzoz From what i remember while working on this issue (one year ago already), the "fork mode" using |
@bzoz is there any value in me keeping this open then? |
@vmarchaud hm, I observed the window popping out for a split-second when using @cjihrig I think we should keep this open. At least until we verify what is the exact issue here. |
@bzoz would you be so kind look into this issue further and assign this to yourself? It seems like you know what you have to look for and keeping a issue open to maybe look into something later on is not the best way to handle it ;-) |
There is discussion going on in #15217 about this |
@bzoz thanks for pointing this out. |
I completely failed to figure out the specific conditions under which console windows pop up, much less that this flag prevents it, when I tried (see #2908 (comment)), but people do report this issue, its annoying, and would be great to have a fix for. |
The existing UV_PROCESS_WINDOWS_HIDE flag only applies to executables linked to the WINDOWS subsystem. This allows CONSOLE subsystem applications to pop up a console window. This commit sets the CREATE_NO_WINDOW process flag when UV_PROCESS_WINDOWS_HIDE to prevent this behavior. Refs: nodejs/node#15380 Refs: joyent/libuv#627 Refs: libuv#965 PR-URL: libuv#1558 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
This should be fixed by the next libuv update. |
As @bzoz writes in #15217 (comment) const assert = require('assert');
const cp = require('child_process');
{
const bat = cp.spawn('cmd.exe', ['/k', 'test.cmd'], { stdio: 'ignore', detached: true, windowsHide: true });
bat.on('exit', (code) => {
console.log(`Child exited with code ${code}`);
});
} |
@refack it seems like there are two problems:
|
|
I would prefer to prefix Windows-specific options with |
Fwiw, I'm OK with just |
If this will forever be a WIN32 only flag, we already have |
I agree with @refack. In fact, I picked the name |
Refs: nodejs#15380 Refs: nodejs#15683 Fixes: nodejs#15394 Fixes: nodejs#15770 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backport in #16425. The issue was that a change to the internals of |
Refs: nodejs#15380 PR-URL: nodejs#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: nodejs#15380 PR-URL: nodejs#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
In spawn_sync.cc, two consecutive loops are used to convert data to strings, and compute the size of the data. This commit merges the two independent loops into one. Refs: nodejs#15380 PR-URL: nodejs#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
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. Backport-PR-URL: #16425 Fixes: #15217 PR-URL: #15380 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
In spawn_sync.cc, two consecutive loops are used to convert data to strings, and compute the size of the data. This commit merges the two independent loops into one. Backport-PR-URL: #16426 Refs: #15380 PR-URL: #16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: nodejs/node#15380 PR-URL: nodejs/node#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: nodejs/node#15380 PR-URL: nodejs/node#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
In spawn_sync.cc, two consecutive loops are used to convert data to strings, and compute the size of the data. This commit merges the two independent loops into one. Refs: nodejs/node#15380 PR-URL: nodejs/node#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Should this be backported to |
In light of libuv/libuv#1625, currently not well-understood, it's probably better to hold off a little longer. I'll add labels. |
Hm, hadn't noticed this has already been merged into v8.x. If no bugs have been reported, then I guess there is no reason to keep it out of v6.x. |
In the case of PM2, we added the |
Refs: nodejs/node#15380 PR-URL: nodejs/node#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Refs: nodejs/node#15380 PR-URL: nodejs/node#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
In spawn_sync.cc, two consecutive loops are used to convert data to strings, and compute the size of the data. This commit merges the two independent loops into one. Refs: nodejs/node#15380 PR-URL: nodejs/node#16247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit exposes the
UV_PROCESS_WINDOWS_HIDE
flag in Node as awindowsHide
option to thechild_process
methods. The option is only applicable to Windows, and is ignored elsewhere.This still needs docs, which I'll write if:
windowsVerbatimArguments
, for example, is not.Fixes: #15217
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
child_process