Ensure command and args are provided correctly
This commit is contained in:
parent
b8c3f7f834
commit
a23afa7772
1 changed files with 10 additions and 4 deletions
|
@ -467,11 +467,17 @@ impl<'a> Runtime<'a> {
|
||||||
})
|
})
|
||||||
.or(env::var("EDITOR").ok())
|
.or(env::var("EDITOR").ok())
|
||||||
.map(|s| {debug!("Editing with '{}'", s); s})
|
.map(|s| {debug!("Editing with '{}'", s); s})
|
||||||
.map(|s| {
|
.and_then(|s| {
|
||||||
let mut c = Command::new(s);
|
let mut split = s.split(" ");
|
||||||
c.stdin(::std::process::Stdio::inherit());
|
let command = split.next();
|
||||||
|
if command.is_none() {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
let mut c = Command::new(command.unwrap()); // secured above
|
||||||
|
c.args(split);
|
||||||
|
c.stdin(::std::process::Stdio::null());
|
||||||
c.stderr(::std::process::Stdio::inherit());
|
c.stderr(::std::process::Stdio::inherit());
|
||||||
c
|
Some(c)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue