Description
Updated report
Now a tracking issue for CommandExt::creation_flags
on Windows.
Open questions:
- Should we provide a method of adding flags as opposed to setting them entirely? Would be a bit more composition-friendly.
Also, don't forget to add to the prelude when stabilizing!
Original report
There's a currently-unused codepath in the Windows implementation of std::process::Command::spawn
that can set DETATCHED_PROCESS
:
rust/src/libstd/sys/windows/process.rs
Line 162 in b1363a7
It looks like historically there was a method to set this but it got removed. Unfortunately there's currently no way to set this, and no other way to set the CreateProcess
flags, so for a project I'm working on I basically had to reimplement spawn
for Windows:
https://github.com/luser/sccache2/blob/89f4b44d01084846893a64137d965ee844fe2d72/src/commands.rs#L103
I think we need some way to set this, even if it's Windows-specific. There are a bunch of other flags that can be specified, so maybe a way to set arbitrary flags would be useful?
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
I think this would fit nicely onto a Windows equivalent of the std::os::unix::process::CommandExt
trait, maybe something like:
trait CommandExt {
fn process_flags(&mut self, flags: u32) -> &mut Command
}