diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-04-17 11:43:14 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-04-17 11:43:14 -0400 |
commit | 40e0305aff57be040fbc0b2914a34ae10bc2d83f (patch) | |
tree | 3f3fc7481b1f4bd271da6779e1f5f17948cd5300 /src/config | |
parent | aee94b2ad2c0b56246cf142dfdb7aba91c42cd04 (diff) |
track child processes and properly close them when complete
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/mimetype/entry.rs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/config/mimetype/entry.rs b/src/config/mimetype/entry.rs index bf65e59..c6c0307 100644 --- a/src/config/mimetype/entry.rs +++ b/src/config/mimetype/entry.rs @@ -1,8 +1,6 @@ use serde_derive::Deserialize; use std::env; use std::fmt; -use std::io::Read; -use std::process; #[derive(Clone, Debug, Deserialize)] pub struct AppList { @@ -114,33 +112,6 @@ impl AppMimetypeEntry { .map(|path| env::split_paths(&path).any(|dir| dir.join(program).is_file())) .unwrap_or(false) } - - pub fn execute_with<I, S>(&self, paths: I) -> std::io::Result<()> - where - I: IntoIterator<Item = S>, - S: AsRef<std::ffi::OsStr>, - { - let program = String::from(self.get_command()); - - let mut command = process::Command::new(program); - if self.get_silent() { - command.stdout(process::Stdio::null()); - command.stderr(process::Stdio::null()); - } - - command.args(self.get_args()); - command.args(paths); - - let mut handle = command.spawn()?; - if !self.get_fork() { - handle.wait()?; - if self.get_confirm_exit() { - println!(" --- Press ENTER to continue --- "); - std::io::stdin().bytes().next(); - } - } - Ok(()) - } } impl std::default::Default for AppMimetypeEntry { |