pub struct CommandRequest { /* private fields */ }Expand description
One program, one literal argument vector, and the bounds it runs under.
There is no env, no current_dir, and no shell. See the module
documentation for why each absence is a control rather than an omission.
There is no Default either, and that absence is the same kind of control:
Duration’s default is zero, so a defaulted request would carry a deadline
that has already passed and kill every child at the first poll.
CommandRequest::new is the only way to build one, and it starts from
DEFAULT_TIMEOUT.
Implementations§
Source§impl CommandRequest
impl CommandRequest
Sourcepub fn args<I, S>(self, arguments: I) -> Self
pub fn args<I, S>(self, arguments: I) -> Self
Appends several arguments, verbatim and in order.
Sourcepub fn with_input(self, input: ChildInput) -> Self
pub fn with_input(self, input: ChildInput) -> Self
Gives the child something on stdin.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Replaces the default deadline.
Sourcepub fn with_limits(self, limits: OutputLimits) -> Self
pub fn with_limits(self, limits: OutputLimits) -> Self
Replaces the default capture bounds.
Sourcepub fn with_cancellation(self, cancellation: Cancellation) -> Self
pub fn with_cancellation(self, cancellation: Cancellation) -> Self
Lets a caller kill this child before its deadline.
Sourcepub fn argument_strings(&self) -> Vec<String>
pub fn argument_strings(&self) -> Vec<String>
The argument vector as lossy strings, for assertions and diagnostics.
Sourcepub fn input(&self) -> &ChildInput
pub fn input(&self) -> &ChildInput
What the child will see on stdin.
Sourcepub fn limits(&self) -> OutputLimits
pub fn limits(&self) -> OutputLimits
The capture bounds.
Sourcepub fn cancellation(&self) -> Option<&Cancellation>
pub fn cancellation(&self) -> Option<&Cancellation>
The cancellation flag, when one was attached.
Sourcepub fn refuse_payload_in_argv(&self) -> Result<(), WslError>
pub fn refuse_payload_in_argv(&self) -> Result<(), WslError>
Refuses the launch when the stdin payload is also in the command line.
The same tripwire as crate::process::SpawnSpec::spawn_with_handoff,
and with the same honest limits: it looks for the payload as a verbatim
byte substring of the program path and of each argument, and that is
all. A payload that is re-encoded, split across two arguments, or
normalised differently walks straight past it. It is here because an
obvious mistake should fail the launch rather than fail a review — not
because passing it is evidence of anything.
Payloads larger than a Windows command line cannot be in one, so they are not scanned.
§Errors
WslError::SecretInCommandLine naming where the payload was found.