diff options
author | Canop <cano.petrole@gmail.com> | 2018-11-25 11:04:07 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2018-11-25 11:04:07 +0100 |
commit | c2e5f189eea3ea0442aaf0a63215b68fc649b8b0 (patch) | |
tree | 164422fa730662956c4f0447ca0ac96d2ce88eca /src/external.rs | |
parent | ed1661cf8a2e467a5e7edc156a77b27e9ed6365a (diff) |
complete command parsing, verb, basic execution
Diffstat (limited to 'src/external.rs')
-rw-r--r-- | src/external.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/external.rs b/src/external.rs index a2911a3..76ba479 100644 --- a/src/external.rs +++ b/src/external.rs @@ -1,6 +1,19 @@ use std::process::Command; use std::path::{PathBuf}; + +pub fn execute(exec: &str) { + let mut tokens = exec.split_whitespace(); + match tokens.next() { + Some(exe) => { + Command::new(exe).args(tokens).spawn().expect("failed to start external exectutable"); + }, + None => { + // FIXME panic? + }, + } +} + pub fn open_file(path: &PathBuf) { Command::new("xdg-open") .arg(String::from(path.to_string_lossy())) |