Command

Struct Command 

Source
pub struct Command { /* private fields */ }
Expand description

Builder for executing a command

Implementations§

Source§

impl Command

Source

pub fn args<I, S>(&mut self, args: I) -> &mut Command
where I: IntoIterator<Item = S>, S: Into<JsString>,

Specified additional command arguments

Source

pub fn arg<S: Into<JsString>>(&mut self, arg: S) -> &mut Command

Specify a command argument

Source

pub async fn exec(&mut self) -> Result<i32, JsValue>

Executes the command and returns the status code

Source

pub fn outline<F: Fn(&str) + 'static + Sync + Send>( &mut self, callback: F, ) -> &mut Command

Sets a callback to be called each time a new line is written to standard output. Note that line splitting is done by an internal re-implementation of line splitting and not the GitHub Actions Toolkit one due to issues with the latter.

Source

pub fn errline<F: Fn(&str) + 'static + Sync + Send>( &mut self, callback: F, ) -> &mut Command

Sets a callback to be called each time a new line is written to standard error. Note that line splitting is done by an internal re-implementation of line splitting and not the GitHub Actions Toolkit one due to issues with the latter.

Source

pub fn stdout(&mut self, redirect: Stdio) -> &mut Command

Sets where standard output should be directed

Source

pub fn stderr(&mut self, redirect: Stdio) -> &mut Command

Sets where standard error should be directed

Source

pub fn current_dir(&mut self, path: &Path) -> &mut Command

Sets the current working directory of the command

Trait Implementations§

Source§

impl<'a> From<&'a Path> for Command

Source§

fn from(path: &'a Path) -> Command

Constructs a command that will execute the file at the specified path.

Auto Trait Implementations§

§

impl Freeze for Command

§

impl !RefUnwindSafe for Command

§

impl !Send for Command

§

impl !Sync for Command

§

impl Unpin for Command

§

impl !UnwindSafe for Command

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.