pub trait CommandExt: Sealed {
fn creation_flags(&mut self, flags: u32) -> &mut Command;
fn force_quotes(&mut self, enabled: bool) -> &mut Command;
fn raw_arg<S: AsRef<OsStr>>(
&mut self,
text_to_append_as_is: S
) -> &mut Command;
}
Expand description
Windows-specific extensions to the process::Command
builder.
This trait is sealed: it cannot be implemented outside the standard library. This is so that future additional methods are not breaking changes.
Required methods
fn creation_flags(&mut self, flags: u32) -> &mut Command
fn creation_flags(&mut self, flags: u32) -> &mut Command
Sets the process creation flags to be passed to CreateProcess
.
These will always be ORed with CREATE_UNICODE_ENVIRONMENT
.
fn force_quotes(&mut self, enabled: bool) -> &mut Command
fn force_quotes(&mut self, enabled: bool) -> &mut Command
Forces all arguments to be wrapped in quote ("
) characters.
This is useful for passing arguments to MSYS2/Cygwin based
executables: these programs will expand unquoted arguments containing
wildcard characters (?
and *
) by searching for any file paths
matching the wildcard pattern.
Adding quotes has no effect when passing arguments to programs that use msvcrt. This includes programs built with both MinGW and MSVC.
Append literal text to the command line without any quoting or escaping.
This is useful for passing arguments to cmd.exe /c
, which doesn’t follow
CommandLineToArgvW
escaping rules.