Skip to main content

CommandExt

Trait CommandExt 

Source
pub trait CommandExt {
    // Required methods
    fn spawn_pty_async(&mut self, ptymaster: &AsyncPtyMaster) -> Result<Child>;
    fn spawn_pty_async_raw(
        &mut self,
        ptymaster: &AsyncPtyMaster,
    ) -> Result<Child>;
}
Expand description

An extension trait for the std::process::Command type.

This trait provides new spawn_pty_async and spawn_pty_async_raw methods that allow one to spawn a new process that is connected to the current process through a pseudo-TTY.

Required Methods§

Source

fn spawn_pty_async(&mut self, ptymaster: &AsyncPtyMaster) -> Result<Child>

Spawn a subprocess that connects to the current one through a pseudo-TTY in canonical (“cooked“, not “raw”) mode.

This function creates the necessary PTY slave and uses std::process::Command::before_exec to do the neccessary setup before the child process is spawned. In particular, it calls setsid() to launch a new TTY sesson.

The child process’s standard input, standard output, and standard error are all connected to the pseudo-TTY slave.

Source

fn spawn_pty_async_raw(&mut self, ptymaster: &AsyncPtyMaster) -> Result<Child>

Spawn a subprocess that connects to the current one through a pseudo-TTY in raw (“non-canonical”, not “cooked”) mode.

This function creates the necessary PTY slave and uses std::process::Command::before_exec to do the neccessary setup before the child process is spawned. In particular, it sets the slave PTY handle to raw mode and calls setsid() to launch a new TTY sesson.

The child process’s standard input, standard output, and standard error are all connected to the pseudo-TTY slave.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CommandExt for Command

Source§

fn spawn_pty_async(&mut self, ptymaster: &AsyncPtyMaster) -> Result<Child>

Source§

fn spawn_pty_async_raw(&mut self, ptymaster: &AsyncPtyMaster) -> Result<Child>

Implementors§