pub struct Cmd { /* private fields */ }Expand description
Implementations§
Source§impl Cmd
impl Cmd
Sourcepub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Cmd
pub fn env(self, key: impl Into<OsString>, value: impl Into<OsString>) -> Cmd
Add one environment variable.
Sourcepub fn env_remove(self, key: impl Into<OsString>) -> Cmd
pub fn env_remove(self, key: impl Into<OsString>) -> Cmd
Remove an environment variable (applied after inherited env).
Sourcepub fn env_clear(self) -> Cmd
pub fn env_clear(self) -> Cmd
Clear the entire inherited environment; only .env() / .envs() reach the child.
Sourcepub fn stdin(self, data: impl Into<StdinData>) -> Cmd
pub fn stdin(self, data: impl Into<StdinData>) -> Cmd
Feed data into the child’s stdin.
Accepts Vec<u8>, &[u8], String, &str, or StdinData::from_reader
for streaming input. Owned bytes are re-fed on each retry; readers are
one-shot.
Sourcepub fn stderr(self, mode: Redirection) -> Cmd
pub fn stderr(self, mode: Redirection) -> Cmd
Configure stderr routing. Default is Redirection::Capture.
Sourcepub fn deadline(self, deadline: Instant) -> Cmd
pub fn deadline(self, deadline: Instant) -> Cmd
Kill if not done by this instant (composes across retries).
Sourcepub fn retry(self, policy: RetryPolicy) -> Cmd
pub fn retry(self, policy: RetryPolicy) -> Cmd
Attach a RetryPolicy. Defaults retry up to 3× on transient errors.
Sourcepub fn retry_when(
self,
f: impl Fn(&RunError) -> bool + Send + Sync + 'static,
) -> Cmd
pub fn retry_when( self, f: impl Fn(&RunError) -> bool + Send + Sync + 'static, ) -> Cmd
Replace the retry predicate without changing the backoff schedule.
If no RetryPolicy is set yet, this installs the default policy and
then overrides its predicate.
Sourcepub fn secret(self) -> Cmd
pub fn secret(self) -> Cmd
Mark this command as containing secrets.
CmdDisplay and RunError render args as <secret> instead of
their values. Useful for docker login, kubectl --token=…, etc.
Sourcepub fn before_spawn<F>(self, hook: F) -> Cmd
pub fn before_spawn<F>(self, hook: F) -> Cmd
Register a hook called immediately before each spawn attempt.
Sourcepub fn to_command(&self) -> Command
pub fn to_command(&self) -> Command
Build a raw std::process::Command mirroring this Cmd’s configuration.
Escape hatch for cases procpilot’s builder doesn’t cover. Does not apply stdin data, timeout, retry, or stderr redirection — those are runner-level concerns.
Sourcepub fn display(&self) -> CmdDisplay
pub fn display(&self) -> CmdDisplay
Snapshot the command for display/logging.