Skip to content
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

Revert "child_process: change windowsHide default to true" #24034

Closed
wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Nov 2, 2018

This reverts commit 420d8af.

I'm opening this not because I'm convinced the commit needs to be reverted, but to hopefully elicit a prompt conversation and decision about whether or not it should be reverted.

Refs: #21316 (comment) and several subsequent comments.

I'm particularly interested in what embedders, especially Electron folks, think. @MarshallOfSound has already weighed in that they don't believe a revert is warranted, but also expressed it as a personal opinion (so, I assume, not speaking on behalf of Electron). Would love to hear from @codebytere or @zeke or @groundwater or someone, either to get a consensus of personal opinions or else to get a semi-official "Electron prefers revert/no-revert".

@nodejs/embedders

IIUC, this is only affecting developers and not end users. Doing this out of an abundance of caution and in case I"m wrong about that.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label Nov 2, 2018
@refack refack added the windows Issues and PRs related to the Windows platform. label Nov 2, 2018
@Trott
Copy link
Member Author

Trott commented Nov 2, 2018

@bzoz
Copy link
Contributor

bzoz commented Nov 2, 2018

FWIW this was added because it was requested by electron in libuv/libuv#1878

@ryzokuken
Copy link
Contributor

@bzoz totally! You'd have to agree though that this did kinda bamboozle Electron. I mean, it was intended to hide phantom console windows from popping up, GUI windows were never in the equation (why would we even want that?).

That said, it's a problem that could be easily solved on Electron's end so this might not be necessary.

@refack
Copy link
Contributor

refack commented Nov 2, 2018

I think the actual problem that was experienced by Electron was fixed in:
libuv/libuv#1558
and
libuv/libuv#1659
IIUC it was that even when windowsHide was set to true a console window would flash and disappear.

@ryzokuken
Copy link
Contributor

@refack well, that'll be great news in favor of reverting.

I'll let y'all know what the consensus is on this. That'll have to wait until Monday though.

@refack
Copy link
Contributor

refack commented Nov 2, 2018

This has some WIN32 minutia behind it. And I'm writing the following with some approximations, and only with my own understanding.
The Windows native binary format (PE) has in it's header a field named subsystem, which is commonly either console or windows. Only windows executables can interact with the user, so console binaries are hosted inside conhost.exe which is Windows' analog to a terminal emulator:
image
Node.js for Windows is compiled as a console app so for it to interact with the user it also runs through conhost:
image

So essentially you can only directly spawn console applications applications from node without creating a new Window. Also if you want to spawn a "detached" process (one that's life-cycle is independent of its parent) it has to have it's own window. That window can be "hidden", but it's there.


For reference, the most similar "native" APIs are

(other runtimes such as ActiveState Perl or cpython , have a similar API with the default to hidden=false)

@refack
Copy link
Contributor

refack commented Nov 2, 2018

@yodurr or @bitcrazed could you help me correct any mistakes in the above ^^^^

@codebytere
Copy link
Member

codebytere commented Nov 2, 2018

Electron can work around this, so we'd be +0 on a revert, i would say!

@Trott
Copy link
Member Author

Trott commented Nov 2, 2018

Explicitly pinging the author and approvers of the commit potentially being reverted: @cjihrig @TimothyGu @bzoz @apapirovski @trivikr @addaleax @ryzokuken @BridgeAR

@cjihrig
Copy link
Contributor

cjihrig commented Nov 2, 2018

In a perfect world, I think defaulting to hiding the window is the correct behavior. This doesn't impact me personally, so I'm fine with deferring to the people that are impacted. I will say though that I was under the impression that only console windows would be impacted by the change.

@Trott
Copy link
Member Author

Trott commented Nov 8, 2018

FWIW this was added because it was requested by electron in libuv/libuv#1878

Talked a bit with @codebytere tonight and the upshot seems to be that a change in libuv was requested, but that this change in Node.js was not quite what they wanted. They can live with this, but do have a slight preference to it being reverted.

@Trott Trott added dont-land-on-v6.x notable-change PRs with changes that should be highlighted in changelogs. labels Nov 8, 2018
@Trott
Copy link
Member Author

Trott commented Nov 9, 2018

Approvals on this from two Electron team members and two Windows-centric collaborators. I'm going to land on master in 24 hours if there's no objections.

Since this is reverting a semver-major, landing on v11.x-staging may require some TSC buy-in so: ping @nodejs/tsc for concerns/objections. I discussed this briefly with @ofrobots yesterday and he was in favor of reverting on 11.x rather than waiting for more people to rely on the new behavior. I concur, so that's two of us....

@sindresorhus
Copy link

It seems like everyone agrees that hiding is the best default for users, so I'm surprised you're making Node.js worse for end-users just because of an embedder. Electron can work around this. If this is merged, every usage of childProcess.spawn() will have to include this option. I strongly oppose this change.

@Trott
Copy link
Member Author

Trott commented Nov 12, 2018

Last CI run was all green, but it was also 10 days ago, and a lot of code has landed since then. So just to be super extra special careful, here's another CI: https://ci.nodejs.org/job/node-test-pull-request/18563/

@Fishrock123
Copy link
Contributor

Wait was this actually not desirable?

@Trott
Copy link
Member Author

Trott commented Nov 13, 2018

@Trott
Copy link
Member Author

Trott commented Nov 13, 2018

Landed in ad6ead3

@Trott Trott closed this Nov 13, 2018
Trott added a commit to Trott/io.js that referenced this pull request Nov 13, 2018
This reverts commit 420d8af.

PR-URL: nodejs#24034
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
@refack refack added the v11.x label Nov 13, 2018
BridgeAR added a commit that referenced this pull request Nov 14, 2018
Notable changes:

* child_process:
  * All child processes will again open up a new Window on Windows by
    default. [#24034](#24034)
* deps:
  * A new and fast experimental HTTP parser (`llhttp`) is now supported.
    [#24059](#24059)
* Added new collaborators:
  * [oyyd](https://github.com/oyyd) - Ouyang Yadong.
    [#24300](#24300)
  * [psmarshall](https://github.com/psmarshall) - Peter Marshall.
    [#24170](#24170)
  * [shisama](https://github.com/shisama) - Masashi Hirano.
    [#24136](#24136)
BridgeAR pushed a commit that referenced this pull request Nov 14, 2018
This reverts commit 420d8af.

PR-URL: #24034
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
BridgeAR added a commit that referenced this pull request Nov 14, 2018
Notable changes:

* child_process:
  * All child processes will again open up a new Window on Windows by
    default. [#24034](#24034)
* deps:
  * A new and fast experimental HTTP parser (`llhttp`) is now supported.
    [#24059](#24059)
* **Windows**
  * A crashing process will now show the names of stack frames if the
    node.pdb file is available.
    [#23822](#23822)
* Added new collaborators:
  * [oyyd](https://github.com/oyyd) - Ouyang Yadong.
    [#24300](#24300)
  * [psmarshall](https://github.com/psmarshall) - Peter Marshall.
    [#24170](#24170)
  * [shisama](https://github.com/shisama) - Masashi Hirano.
    [#24136](#24136)
kiyomizumia pushed a commit to kiyomizumia/node that referenced this pull request Nov 15, 2018
This reverts commit 420d8af.

PR-URL: nodejs#24034
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
BridgeAR pushed a commit that referenced this pull request Nov 15, 2018
This reverts commit 420d8af.

PR-URL: #24034
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
targos pushed a commit that referenced this pull request Nov 15, 2018
Notable changes:

* deps:
  * A new experimental HTTP parser (`llhttp`) is now supported.
    #24059
* timers:
  * Fixed an issue that could cause setTimeout to stop working as
    expected. #24322
* Windows
  * A crashing process will now show the names of stack frames if the
    node.pdb file is available.
    #23822
  * Continued effort to improve the installer's new stage that installs
    native build tools.
    #23987,
    #24348
  * child_process:
    * On Windows the `windowsHide` option default was restored to
      `false`. This means `detached` child processes and GUI apps will
      once again start in a new window.
      #24034
* Added new collaborators:
  * [oyyd](https://github.com/oyyd) - Ouyang Yadong.
    #24300
  * [psmarshall](https://github.com/psmarshall) - Peter Marshall.
    #24170
  * [shisama](https://github.com/shisama) - Masashi Hirano.
    #24136
targos pushed a commit that referenced this pull request Nov 15, 2018
Notable changes:

* deps:
  * A new experimental HTTP parser (`llhttp`) is now supported.
    #24059
* timers:
  * Fixed an issue that could cause setTimeout to stop working as
    expected. #24322
* Windows
  * A crashing process will now show the names of stack frames if the
    node.pdb file is available.
    #23822
  * Continued effort to improve the installer's new stage that installs
    native build tools.
    #23987,
    #24348
  * child_process:
    * On Windows the `windowsHide` option default was restored to
      `false`. This means `detached` child processes and GUI apps will
      once again start in a new window.
      #24034
* Added new collaborators:
  * [oyyd](https://github.com/oyyd) - Ouyang Yadong.
    #24300
  * [psmarshall](https://github.com/psmarshall) - Peter Marshall.
    #24170
  * [shisama](https://github.com/shisama) - Masashi Hirano.
    #24136

PR-URL: #24350
@Trott Trott deleted the revert-420d8af branch January 13, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. notable-change PRs with changes that should be highlighted in changelogs. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.