Struct CommandBuilder
pub struct CommandBuilder { /* private fields */ }terminal only.Expand description
CommandBuilder is used to prepare a command to be spawned into a pty.
The interface is intentionally similar to that of std::process::Command.
Implementations§
§impl CommandBuilder
impl CommandBuilder
pub fn new<S>(program: S) -> CommandBuilder
pub fn new<S>(program: S) -> CommandBuilder
Create a new builder instance with argv[0] set to the specified program.
pub fn from_argv(args: Vec<OsString>) -> CommandBuilder
pub fn from_argv(args: Vec<OsString>) -> CommandBuilder
Create a new builder instance from a pre-built argument vector
pub fn set_controlling_tty(&mut self, controlling_tty: bool)
pub fn set_controlling_tty(&mut self, controlling_tty: bool)
Set whether we should set the pty as the controlling terminal. The default is true, which is usually what you want, but you may need to set this to false if you are crossing container boundaries (eg: flatpak) to workaround issues like: https://github.com/flatpak/flatpak/issues/3697 https://github.com/flatpak/flatpak/issues/3285
pub fn get_controlling_tty(&self) -> bool
pub fn new_default_prog() -> CommandBuilder
pub fn new_default_prog() -> CommandBuilder
Create a new builder instance that will run some idea of a default
program. Such a builder will panic if arg is called on it.
pub fn is_default_prog(&self) -> bool
pub fn is_default_prog(&self) -> bool
Returns true if this builder was created via new_default_prog
pub fn arg<S>(&mut self, arg: S)
pub fn arg<S>(&mut self, arg: S)
Append an argument to the current command line.
Will panic if called on a builder created via new_default_prog.
pub fn args<I, S>(&mut self, args: I)
pub fn args<I, S>(&mut self, args: I)
Append a sequence of arguments to the current command line
pub fn get_argv(&self) -> &Vec<OsString>
pub fn get_argv_mut(&mut self) -> &mut Vec<OsString>
pub fn env<K, V>(&mut self, key: K, value: V)
pub fn env<K, V>(&mut self, key: K, value: V)
Override the value of an environmental variable
pub fn env_remove<K>(&mut self, key: K)
pub fn env_clear(&mut self)
pub fn get_env<K>(&self, key: K) -> Option<&OsStr>
pub fn cwd<D>(&mut self, dir: D)
pub fn clear_cwd(&mut self)
pub fn get_cwd(&self) -> Option<&OsString>
pub fn iter_extra_env_as_str(&self) -> impl Iterator<Item = (&str, &str)>
pub fn iter_extra_env_as_str(&self) -> impl Iterator<Item = (&str, &str)>
Iterate over the configured environment. Only includes environment
variables set by the caller via env, not variables set in the base
environment.
pub fn iter_full_env_as_str(&self) -> impl Iterator<Item = (&str, &str)>
pub fn as_unix_command_line(&self) -> Result<String, Error>
pub fn as_unix_command_line(&self) -> Result<String, Error>
Return the configured command and arguments as a single string, quoted per the unix shell conventions.
Trait Implementations§
§impl Clone for CommandBuilder
impl Clone for CommandBuilder
§fn clone(&self) -> CommandBuilder
fn clone(&self) -> CommandBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CommandBuilder
impl Debug for CommandBuilder
§impl PartialEq for CommandBuilder
impl PartialEq for CommandBuilder
impl StructuralPartialEq for CommandBuilder
Auto Trait Implementations§
impl Freeze for CommandBuilder
impl RefUnwindSafe for CommandBuilder
impl Send for CommandBuilder
impl Sync for CommandBuilder
impl Unpin for CommandBuilder
impl UnwindSafe for CommandBuilder
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> ComponentProps for T
impl<T> ComponentProps for T
fn changed(&self, other: &(dyn ComponentProps + 'static)) -> bool
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
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