mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-29 22:51:33 +02:00
[process] Remove some more unwrap
This commit is contained in:
parent
6a23f77687
commit
3dd2f797ab
@ -1,9 +1,10 @@
|
|||||||
|
use error::Result;
|
||||||
use pathop::PathOp;
|
use pathop::PathOp;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub fn spawn(cmd: &Vec<String>, updated_paths: &[PathOp], no_shell: bool) -> Process {
|
pub fn spawn(cmd: &Vec<String>, updated_paths: &[PathOp], no_shell: bool) -> Result<Process> {
|
||||||
self::imp::Process::new(cmd, updated_paths, no_shell).expect("unable to spawn process")
|
self::imp::Process::new(cmd, updated_paths, no_shell).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use self::imp::Process;
|
pub use self::imp::Process;
|
||||||
@ -398,7 +399,7 @@ fn collect_path_env_vars(pathops: &[PathOp]) -> Vec<(String, String)> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut vars = vec![];
|
let mut vars = Vec::new();
|
||||||
// Only break off a common path if we have more than one unique path,
|
// Only break off a common path if we have more than one unique path,
|
||||||
// otherwise we end up with a `COMMON_PATH` being set and other vars
|
// otherwise we end up with a `COMMON_PATH` being set and other vars
|
||||||
// being present but empty.
|
// being present but empty.
|
||||||
@ -481,7 +482,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_start() {
|
fn test_start() {
|
||||||
let _ = spawn(&vec!["echo".into(), "hi".into()], vec![], true);
|
let _ = spawn(&vec!["echo".into(), "hi".into()], &[], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -600,7 +601,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_start() {
|
fn test_start() {
|
||||||
let _ = spawn(&vec!["echo".into(), "hi".into()], vec![], true);
|
let _ = spawn(&vec!["echo".into(), "hi".into()], &[], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -154,7 +154,7 @@ impl ExecHandler {
|
|||||||
&self.args.cmd,
|
&self.args.cmd,
|
||||||
ops,
|
ops,
|
||||||
self.args.no_shell,
|
self.args.no_shell,
|
||||||
));
|
)?);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user