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

Spawn detached window hide option #2908

Closed

Conversation

sam-github
Copy link
Contributor

Detached children are run in a new console window by default. For
children that are intended to run in the background with no console I/O,
this window is an annoying pop-up, so uv allows it to be hidden.

I can't think of a way to test this other than manually, which I still have to do, but @piscisaureus, this is what you suggested (I think).

/cc @nodejs/platform-windows

Includes a bit of the docs from #2903.

@sam-github sam-github added child_process Issues and PRs related to the child_process subsystem. windows Issues and PRs related to the Windows platform. semver-minor PRs that contain new features and should be released in the next minor version. labels Sep 16, 2015
@@ -219,6 +219,7 @@ namespace node {
V(verify_error_string, "verifyError") \
V(version_string, "version") \
V(weight_string, "weight") \
V(windows_hide_string, "hide") \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be hide_string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was modelling it after the UV constant name, but I see that hide_string would be better, done.

@bnoordhuis
Copy link
Member

LGTM. hide only makes sense when combined with detached? Maybe you can reject invalid combinations?

@sam-github
Copy link
Contributor Author

I could assert that if .hide is true, so is .detached, that's the only "invalid" combination (its not really invalid, in that uv ignores it, I think).

If there is no detached window, its a harmless nul-op. I'm not sure if asserting would make the API more predictable and avoid people wondering why hide didn't do anything (not sure what they would be thinking it would do, though, if detached was not set), or more annoying, I'm a bit on the fence.

But you think it would help people if they were hoping that .hide had some meaning independent of .detached by failing fast?

@piscisaureus
Copy link
Contributor

hide only makes sense when combined with detached? Maybe you can reject invalid combinations?

Yeah, I don't really see the point of that. windows_verbatim_arguments doesn't throw on *nix either, does it?

@bnoordhuis
Copy link
Member

Virtual shrug, no strong opinion. Any future bug reports, I'll assign them to you guys.

@piscisaureus
Copy link
Contributor

I'm +1 on this, but since I suggested it in the first place I'd like to get another LGTM from @orangemocha or @joaocgreis or @mscdex .

@rvagg
Copy link
Member

rvagg commented Sep 16, 2015

sort of related #556

@@ -366,8 +366,11 @@ callback or returning an EventEmitter).
* `env` {Object} Environment key-value pairs
* `stdio` {Array|String} Child's stdio configuration. (See
[below](#child_process_options_stdio))
* `detached` {Boolean} The child will be a process group leader. (See
* `detached` {Boolean} Prepare child to run independently of it's parent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/it's/its/

@mscdex
Copy link
Contributor

mscdex commented Sep 16, 2015

One minor nit, but otherwise LGTM.

@sam-github sam-github force-pushed the spawn-detached-window-hide-option branch from ea16d4a to dc4e069 Compare September 16, 2015 20:02
@orangemocha
Copy link
Contributor

Generally LGTM.

Regarding the semantics of hide when not detached, I have two suggestions, alternative to each other:

  1. Has no effect if not detached => Is ignored if not detached, and actually don't pass it to libuv. It prevents any foreseeable side-effects so that there are no bugs down the road.
  2. Instead of detached + hide, support a background option that does the combination of those two (hide is not necessary at that point).

@sam-github
Copy link
Contributor Author

2 seems somewhat easier to use, and more expressive of the intent, but slightly disconnected from uv.

Also, neither detached or background really do anything like what the option name would suggest on non-Windows. I kindof like that about hide, its clearly a windows specific variant of attached (edit: detached is what I meant to write), and easy to describe as a no-op on Linux.

I can write code that sets detached and hide, and it will work on v0.10, there will just be an ugly window, and will work better once this PR merges. For background, I would have to set detached and background, so its all about the same to me (as long as the combination is supported - if I have to start do node version checking to see what options to pass I'll be annoyed!).

I think I just talked myself into prefering @orangemocha's option 1. :-)

@orangemocha
Copy link
Contributor

For background, I would have to set detached and background, so its all about the same to me

Just to clarify, background wouldn't require detached. Just passing background would give you the same semantics as the current detached + hide.

@sam-github
Copy link
Contributor Author

@orangemocha I understand, but I would always pass both, because then it would work on v0.10 and v4.wherever-this-is-released.

@orangemocha
Copy link
Contributor

@sam-github : got it now. It makes sense -considered the need for backward compatbility- that an additive property like hide is preferable. LGTM and feel free to take or leave the suggestion at 1) (not passing UV_PROCESS_WINDOWS_HIDE to uv when not needed).

mscdex and others added 10 commits February 15, 2016 11:30
Reassigning a named parameter while also using the arguments
object causes the entire function to never be optimized.

PR-URL: nodejs#4613
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
To enable greater parallelization of tests on CI, move resource
intensive tests out of parallel and into sequential.

Ref: nodejs#4476
PR-URL: nodejs#4615
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
In test-cluster-worker-wait-server-close, remove unneeded 1-second delay
and refactor to eliminate flakiness on FreeBSD.

PR-URL: nodejs#4616
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#4617
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Do not attempt to read data from the socket whilst on OpenSSL's stack,
weird things may happen, and this is most likely going to result in some
kind of error.

PR-URL: nodejs#4624
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Some variables are declared with var more than once in the same scope.
This change reduces the declarations to one per scope.

PR-URL: nodejs#4633
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
A 50ms timeout results in a race condition. Instead, enforce expected
order through callbacks. This has the side effect of speeding up the
test in most situations.

Ref: nodejs#4476
PR-URL: nodejs#4637
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#4639
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chris Dickinson <chris@neversaw.us>
This comment was added with an assumption that we could determine the
IP address that localhost should resolve to without performing a
lookup. This was a false assumption and should be removed.

PR-URL: nodejs#4648
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Prior to this commit, the test was flaky because it was
executing the majority of its logic in a function called from
the client and multiple events on the server. This commit
simplifies the test by separating the server's connection and
listening events, and isolating the client logic.

Refs: nodejs#4476
Refs: nodejs#4644
PR-URL: nodejs#4650
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
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. semver-minor PRs that contain new features and should be released in the next minor version. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.