pub(crate) struct BootstrapCommand {
command: Command,
pub(crate) failure_behavior: BehaviorOnFailure,
pub(crate) run_in_dry_run: bool,
drop_bomb: DropBomb,
should_cache: bool,
}Expand description
Wrapper around std::process::Command.
By default, the command will exit bootstrap if it fails. If you want to allow failures, use allow_failure. If you want to delay failures until the end of bootstrap, use delay_failure.
By default, the command will print its stdout/stderr to stdout/stderr of bootstrap (OutputMode::Print). If you want to handle the output programmatically, use BootstrapCommand::run_capture.
Bootstrap will print a debug log to stdout if the command fails and failure is not allowed.
By default, command executions are cached based on their workdir, program, arguments, and environment variables. This avoids re-running identical commands unnecessarily, unless caching is explicitly disabled.
Fields§
§command: Command§failure_behavior: BehaviorOnFailure§run_in_dry_run: bool§drop_bomb: DropBomb§should_cache: boolImplementations§
Source§impl<'a> BootstrapCommand
impl<'a> BootstrapCommand
pub(crate) fn new<S: AsRef<OsStr>>(program: S) -> Self
pub(crate) fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
Sourcepub(crate) fn cached(&mut self) -> &mut Self
pub(crate) fn cached(&mut self) -> &mut Self
Cache the command. If it will be executed multiple times with the exact same arguments and environment variables in the same bootstrap invocation, the previous result will be loaded from memory.
pub(crate) fn args<I, S>(&mut self, args: I) -> &mut Self
pub(crate) fn env<K, V>(&mut self, key: K, val: V) -> &mut Self
pub(crate) fn get_envs(&self) -> CommandEnvs<'_> ⓘ
pub(crate) fn get_args(&self) -> CommandArgs<'_> ⓘ
pub(crate) fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut Self
pub(crate) fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut Self
pub(crate) fn stdin(&mut self, stdin: Stdio) -> &mut Self
pub(crate) fn delay_failure(self) -> Self
pub(crate) fn fail_fast(self) -> Self
pub(crate) fn allow_failure(self) -> Self
pub(crate) fn run_in_dry_run(&mut self) -> &mut Self
Sourcepub(crate) fn run(&mut self, exec_ctx: impl AsRef<ExecutionContext>) -> bool
pub(crate) fn run(&mut self, exec_ctx: impl AsRef<ExecutionContext>) -> bool
Run the command, while printing stdout and stderr. Returns true if the command has succeeded.
Sourcepub(crate) fn run_capture(
&mut self,
exec_ctx: impl AsRef<ExecutionContext>,
) -> CommandOutput
pub(crate) fn run_capture( &mut self, exec_ctx: impl AsRef<ExecutionContext>, ) -> CommandOutput
Run the command, while capturing and returning all its output.
Sourcepub(crate) fn run_capture_stdout(
&mut self,
exec_ctx: impl AsRef<ExecutionContext>,
) -> CommandOutput
pub(crate) fn run_capture_stdout( &mut self, exec_ctx: impl AsRef<ExecutionContext>, ) -> CommandOutput
Run the command, while capturing and returning stdout, and printing stderr.
Sourcepub(crate) fn start_capture(
&'a mut self,
exec_ctx: impl AsRef<ExecutionContext>,
) -> DeferredCommand<'a>
pub(crate) fn start_capture( &'a mut self, exec_ctx: impl AsRef<ExecutionContext>, ) -> DeferredCommand<'a>
Spawn the command in background, while capturing and returning all its output.
Sourcepub(crate) fn start_capture_stdout(
&'a mut self,
exec_ctx: impl AsRef<ExecutionContext>,
) -> DeferredCommand<'a>
pub(crate) fn start_capture_stdout( &'a mut self, exec_ctx: impl AsRef<ExecutionContext>, ) -> DeferredCommand<'a>
Spawn the command in background, while capturing and returning stdout, and printing stderr.
Sourcepub(crate) fn stream_capture_stdout(
&'a mut self,
exec_ctx: impl AsRef<ExecutionContext>,
) -> Option<StreamingCommand>
pub(crate) fn stream_capture_stdout( &'a mut self, exec_ctx: impl AsRef<ExecutionContext>, ) -> Option<StreamingCommand>
Spawn the command in background, while capturing and returning stdout, and printing stderr. Returns None in dry-mode
Sourcepub(crate) fn mark_as_executed(&mut self)
pub(crate) fn mark_as_executed(&mut self)
Mark the command as being executed, disarming the drop bomb. If this method is not called before the command is dropped, its drop will panic.
Sourcepub(crate) fn get_created_location(&self) -> Location<'static>
pub(crate) fn get_created_location(&self) -> Location<'static>
Returns the source code location where this command was created.
pub(crate) fn fingerprint(&self) -> CommandFingerprint
Trait Implementations§
Source§impl Debug for BootstrapCommand
impl Debug for BootstrapCommand
Source§impl From<Cargo> for BootstrapCommand
impl From<Cargo> for BootstrapCommand
Source§fn from(cargo: Cargo) -> BootstrapCommand
fn from(cargo: Cargo) -> BootstrapCommand
Auto Trait Implementations§
impl !RefUnwindSafe for BootstrapCommand
impl !UnwindSafe for BootstrapCommand
impl Freeze for BootstrapCommand
impl Send for BootstrapCommand
impl Sync for BootstrapCommand
impl Unpin for BootstrapCommand
impl UnsafeUnpin for BootstrapCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 264 bytes