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§
Sourcefn set_clipboard(&mut self, s: &str) -> Result<()>
fn set_clipboard(&mut self, s: &str) -> Result<()>
Set the clipboard to the given string
Sourcefn read_clipboard(&self) -> Result<String>
fn read_clipboard(&self) -> Result<String>
Read the current contents of the clipboard
Sourcefn store_child_handle(&mut self, cmd: &str, child: Child)
fn store_child_handle(&mut self, cmd: &str, child: Child)
Store a handle to a running Child followinga call to System::run_command.
Sourcefn running_children(&self) -> Vec<String>
fn running_children(&self) -> Vec<String>
Provide an ordered list of currently running child processes by their command string
Sourcefn cleanup_child(&mut self, id: u32)
fn cleanup_child(&mut self, id: u32)
Cleanup any resources associated with a child process that is now complete
Sourcefn kill_child(&mut self, idx: usize)
fn kill_child(&mut self, idx: usize)
Kill a child process by its index in the list returned from System::running_children.
Provided Methods§
Sourcefn n_running_children(&self) -> usize
fn n_running_children(&self) -> usize
The number of currently running child processes
Sourcefn run_command_blocking(
&self,
cmd: &str,
cwd: &Path,
bufid: usize,
) -> Result<String>
fn run_command_blocking( &self, cmd: &str, cwd: &Path, bufid: usize, ) -> Result<String>
Run an external command and collect its output.
Sourcefn run_command(
&mut self,
cmd: &str,
cwd: &Path,
bufid: usize,
tx: Sender<Event>,
) -> Result<()>
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.