pub struct Options {Show 14 fields
pub cwd: Option<PathBuf>,
pub env: Option<HashMap<String, String>>,
pub shell: Option<String>,
pub prefix: String,
pub postfix: String,
pub verbose: bool,
pub quiet: bool,
pub nothrow: bool,
pub timeout: Option<Duration>,
pub timeout_signal: String,
pub kill_signal: String,
pub prefer_local: PreferLocal,
pub input: Option<Vec<u8>>,
pub quote: QuoteFn,
}Expand description
Options controlling how commands are run (the fields of zx $).
Fields§
§cwd: Option<PathBuf>Working directory; None means the process working directory.
env: Option<HashMap<String, String>>Full environment; None inherits the process environment.
shell: Option<String>Shell executable; None means no shell is available.
prefix: StringText prepended to every command.
postfix: StringText appended to every command.
verbose: boolLog commands and their stdout to stderr.
quiet: boolSuppress all logging, including the echo of the command’s stderr.
nothrow: boolResolve (return Ok) even when the command fails.
timeout: Option<Duration>Kill the command after this long.
timeout_signal: StringSignal used when the timeout fires.
kill_signal: StringDefault signal for RunningProcess::kill.
prefer_local: PreferLocalPrepend local node_modules/.bin directories to PATH.
input: Option<Vec<u8>>Data written to the command’s stdin.
quote: QuoteFnFunction used to quote interpolated arguments.
Implementations§
Source§impl Options
impl Options
Sourcepub fn builtin() -> Self
pub fn builtin() -> Self
Built-in defaults: bash (found via PATH, falling back to sh) with
the set -euo pipefail; prefix, everything else off.
Sourcepub fn use_bash(&mut self)
pub fn use_bash(&mut self)
Switch to bash: which bash (or sh), set -euo pipefail; prefix,
no postfix, quote.
Sourcepub fn use_powershell(&mut self)
pub fn use_powershell(&mut self)
Switch to powershell.exe with PowerShell quoting.
Sourcepub fn resolve_env<I, K, V>(&mut self, prefix: &str, env: I)
pub fn resolve_env<I, K, V>(&mut self, prefix: &str, env: I)
Apply <prefix>* environment variables (camel-cased) onto the options.
Recognised names: cwd, preferLocal, verbose, quiet, timeout,
timeoutSignal, killSignal, prefix, postfix, shell. Empty
values and unknown names are ignored.
Sourcepub fn effective_cwd(&self) -> PathBuf
pub fn effective_cwd(&self) -> PathBuf
The effective working directory for spawned commands.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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