-
Notifications
You must be signed in to change notification settings - Fork 10
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
group_spawn() on Windows doesn't allow process creation flags to be set #15
Comments
Yeah, it's there to avoid a race condition where the process ends before we assign it to the group. |
I'm not really sure what to do, tbh. There's no particularly good way to fetch the flags before writing them. I think the two most viable options are:
|
Thanks for the quick response! Given that I think the best solution would be for |
With the linked issue #17 there's a possibility for a different API which would allow this kind of thing more elegantly |
This is now supported (in 2.1.0): https://github.com/watchexec/command-group/blob/main/examples/with_flags.rs |
When calling
group_spawn()
like this......I expect the new process to spawn with the
CREATE_NO_WINDOW
flag applied and to therefore be a background process with no visible window associated. When usingspawn()
, that's exactly how it happens, but when usinggroup_spawn()
, theCREATE_NO_WINDOW
flag is ignored and the process spawns with a visible window.The reason for this behavior is the call to
creation_flags()
insidegroup_spawn()
, which overrides any process creation flags that were previously set:command-group/src/stdlib/windows.rs
Line 13 in 9701d77
If I remove that line from
group_spawn()
, and then call it like this (to preserve theCREATE_SUSPENDED
flag)......I get the expected result (process spawns with no visible window).
Question: is the
CREATE_SUSPENDED
flag necessary here? In my use case, at least, it seems not to be - I don't notice any difference between.creation_flags(CREATE_SUSPENDED|CREATE_NO_WINDOW)
and.creation_flags(CREATE_NO_WINDOW)
.If
CREATE_SUSPENDED
isn't necessary, could thecreation_flags()
call be removed fromgroup_spawn()
to allow that function to behave the same asspawn()
with respect to usingcreation_flags()
to set process creation flags?If
CREATE_SUSPENDED
is necessary here, is there a way that it could be added to any previously set flags, instead of overwriting them?The text was updated successfully, but these errors were encountered: