From a23afa77721e15023bc2edb7d24ff94bd15a22e4 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 12 Mar 2018 23:20:32 +0100 Subject: [PATCH] Ensure command and args are provided correctly --- lib/core/libimagrt/src/runtime.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index 7fe0a959..1e29f96d 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -467,11 +467,17 @@ impl<'a> Runtime<'a> { }) .or(env::var("EDITOR").ok()) .map(|s| {debug!("Editing with '{}'", s); s}) - .map(|s| { - let mut c = Command::new(s); - c.stdin(::std::process::Stdio::inherit()); + .and_then(|s| { + let mut split = s.split(" "); + 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 + Some(c) }) }