System

Trait System 

Source
pub trait System: Debug {
    // Required methods
    fn set_clipboard(&mut self, s: &str) -> Result<()>;
    fn read_clipboard(&self) -> Result<String>;
    fn store_child_handle(&mut self, cmd: &str, child: Child);
    fn running_children(&self) -> Vec<String>;
    fn cleanup_child(&mut self, id: u32);
    fn kill_child(&mut self, idx: usize);

    // Provided methods
    fn n_running_children(&self) -> usize { ... }
    fn run_command_blocking(
        &self,
        cmd: &str,
        cwd: &Path,
        bufid: usize,
    ) -> Result<String> { ... }
    fn run_command(
        &mut self,
        cmd: &str,
        cwd: &Path,
        bufid: usize,
        tx: Sender<Event>,
    ) -> Result<()> { ... }
    fn pipe_through_command(
        &self,
        cmd: &str,
        input: &str,
        cwd: &Path,
        bufid: usize,
    ) -> Result<String> { ... }
}
Expand description

Wrapper around storing system interactions

Required Methods§

Source

fn set_clipboard(&mut self, s: &str) -> Result<()>

Set the clipboard to the given string

Source

fn read_clipboard(&self) -> Result<String>

Read the current contents of the clipboard

Source

fn store_child_handle(&mut self, cmd: &str, child: Child)

Store a handle to a running Child followinga call to System::run_command.

Source

fn running_children(&self) -> Vec<String>

Provide an ordered list of currently running child processes by their command string

Source

fn cleanup_child(&mut self, id: u32)

Cleanup any resources associated with a child process that is now complete

Source

fn kill_child(&mut self, idx: usize)

Kill a child process by its index in the list returned from System::running_children.

Provided Methods§

Source

fn n_running_children(&self) -> usize

The number of currently running child processes

Source

fn run_command_blocking( &self, cmd: &str, cwd: &Path, bufid: usize, ) -> Result<String>

Run an external command and collect its output.

Source

fn run_command( &mut self, cmd: &str, cwd: &Path, bufid: usize, tx: Sender<Event>, ) -> Result<()>

Run an external command and append its output to the output buffer for bufid from a background thread. If the command is successfully spawned then a Child should be stored for later resource cleanup and support for user initiated killing.

Source

fn pipe_through_command( &self, cmd: &str, input: &str, cwd: &Path, bufid: usize, ) -> Result<String>

Pipe input text through an external command, returning the output

Implementors§