pub struct Commands { /* private fields */ }Expand description
Runs commands in a sandbox.
Implementations§
Source§impl Commands
impl Commands
Sourcepub async fn run(&self, cmd: &str) -> Result<CommandResult>
pub async fn run(&self, cmd: &str) -> Result<CommandResult>
Runs cmd with bash (a login shell, so shell syntax works) and waits for it. A non-zero
exit is Error::CommandExit holding the result; a timeout is Error::Timeout.
Sourcepub async fn run_with(&self, cmd: &str, o: RunOptions) -> Result<CommandResult>
pub async fn run_with(&self, cmd: &str, o: RunOptions) -> Result<CommandResult>
run with options.
Sourcepub async fn run_args<I>(&self, argv: I) -> Result<CommandResult>
pub async fn run_args<I>(&self, argv: I) -> Result<CommandResult>
Runs argv directly, without a shell (like Vercel’s runCommand and Modal’s exec). Errors as
for run.
Sourcepub async fn run_args_with<I>(
&self,
argv: I,
o: RunOptions,
) -> Result<CommandResult>
pub async fn run_args_with<I>( &self, argv: I, o: RunOptions, ) -> Result<CommandResult>
run_args with options.
Sourcepub async fn start(&self, cmd: &str) -> Result<CommandHandle>
pub async fn start(&self, cmd: &str) -> Result<CommandHandle>
Runs cmd with bash in the background and returns at once. The command keeps running after
this call (and across a pause); its output goes to files in the sandbox, read with the
returned handle.
Sourcepub async fn start_with(
&self,
cmd: &str,
o: StartOptions,
) -> Result<CommandHandle>
pub async fn start_with( &self, cmd: &str, o: StartOptions, ) -> Result<CommandHandle>
start with options.
Sourcepub async fn start_args_with<I>(
&self,
argv: I,
o: StartOptions,
) -> Result<CommandHandle>
pub async fn start_args_with<I>( &self, argv: I, o: StartOptions, ) -> Result<CommandHandle>
start without a shell.
Sourcepub async fn list(&self) -> Result<Vec<ProcessInfo>>
pub async fn list(&self) -> Result<Vec<ProcessInfo>>
The background commands started in this sandbox (running and finished).
Sourcepub async fn connect(&self, pid: i64) -> Result<CommandHandle>
pub async fn connect(&self, pid: i64) -> Result<CommandHandle>
A handle to a background command by pid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Commands
impl !RefUnwindSafe for Commands
impl Send for Commands
impl Sync for Commands
impl Unpin for Commands
impl UnsafeUnpin for Commands
impl !UnwindSafe for Commands
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].