pub struct Prepare {
pub command: OsString,
pub stdin: Stdio,
pub stdout: Stdio,
pub stderr: Stdio,
pub args: Vec<OsString>,
pub env: Vec<(OsString, OsString)>,
pub use_shell: bool,
}
Expand description
Fields§
§command: OsString
The command to invoke (either with or without shell depending on use_shell
.
stdin: Stdio
The way standard input is configured.
stdout: Stdio
The way standard output is configured.
stderr: Stdio
The way standard error is configured.
args: Vec<OsString>
The arguments to pass to the spawned process.
env: Vec<(OsString, OsString)>
environment variables to set in the spawned process.
use_shell: bool
If true
, we will use sh
to execute the command
.
Implementations§
Source§impl Prepare
Builder
impl Prepare
Builder
Sourcepub fn with_shell(self) -> Self
pub fn with_shell(self) -> Self
If called, the command will not be executed directly, but with sh
.
This also allows to pass shell scripts as command, or use commands that contain arguments which are subsequently
parsed by sh
.
Sourcepub fn without_shell(self) -> Self
pub fn without_shell(self) -> Self
Unconditionally turn off using the shell when spawning the command.
Note that not using the shell is the default so an effective use of this method
is some time after with_shell()
was called.
Sourcepub fn arg(self, arg: impl Into<OsString>) -> Self
pub fn arg(self, arg: impl Into<OsString>) -> Self
Add arg
to the list of arguments to call the command with.
Sourcepub fn args(self, args: impl IntoIterator<Item = impl Into<OsString>>) -> Self
pub fn args(self, args: impl IntoIterator<Item = impl Into<OsString>>) -> Self
Add args
to the list of arguments to call the command with.