pub struct Command { /* private fields */ }
async
only.Expand description
Wrapper around tokio::process::Command
Implementations§
Source§impl Command
impl Command
Sourcepub fn env_remove<K: AsRef<OsStr>>(self, key: K) -> Self
pub fn env_remove<K: AsRef<OsStr>>(self, key: K) -> Self
Sourcepub fn current_dir<P: AsRef<Path>>(self, dir: P) -> Self
pub fn current_dir<P: AsRef<Path>>(self, dir: P) -> Self
Sourcepub fn kill_on_drop(self, kill_on_drop: bool) -> Self
pub fn kill_on_drop(self, kill_on_drop: bool) -> Self
Sourcepub fn spawn(self, pts: Pts) -> Result<Child>
pub fn spawn(self, pts: Pts) -> Result<Child>
Executes the command as a child process via
tokio::process::Command::spawn
on the given pty. The pty will be
attached to all of stdin
, stdout
, and stderr
of the child,
unless those file descriptors were previously overridden through calls
to stdin
, stdout
, or
stderr
. The newly created child process will also be
made the session leader of a new session, and will have the given
pty set as its controlling terminal.
§Errors
Returns an error if we fail to allocate new file descriptors for
attaching the pty to the child process, or if we fail to spawn the
child process (see the documentation for
tokio::process::Command::spawn
), or if we fail to make the child a
session leader or set its controlling terminal.
Sourcepub fn spawn_borrowed(&mut self, pts: &Pts) -> Result<Child>
Available on non-macOS only.
pub fn spawn_borrowed(&mut self, pts: &Pts) -> Result<Child>
Executes the command as a child process via
tokio::process::Command::spawn
on the given pty. The pty will be
attached to all of stdin
, stdout
, and stderr
of the child,
unless those file descriptors were previously overridden through calls
to stdin
, stdout
, or
stderr
. The newly created child process will also be
made the session leader of a new session, and will have the given
pty set as its controlling terminal.
Differs from spawn
in that it borrows the pty rather than consuming
it, allowing for multiple commands to be spawned onto the same pty in
sequence, but this functionality is not available on macos.
§Errors
Returns an error if we fail to allocate new file descriptors for
attaching the pty to the child process, or if we fail to spawn the
child process (see the documentation for
tokio::process::Command::spawn
), or if we fail to make the child a
session leader or set its controlling terminal.