From 3aec9f46d3fee9c5fa0d44d1ee40e76f8eaec2ed Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 5 Aug 2014 11:49:34 -0700 Subject: native, rustuv: Fix spawning with empty args There was a bug in both libnative and libuv which prevented child processes from being spawned correctly on windows when one of the arguments was an empty string. The libuv bug has since been fixed upstream, and the libnative bug was fixed as part of this commit. When updating libuv, this also includes a fix for #15149. Closes #15149 Closes #16272 --- src/libnative/io/process.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libnative') diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs index c89a40d6513..d64e81c6d15 100644 --- a/src/libnative/io/process.rs +++ b/src/libnative/io/process.rs @@ -479,7 +479,10 @@ fn make_command_line(prog: &CString, args: &[CString]) -> String { return cmd; fn append_arg(cmd: &mut String, arg: &str) { - let quote = arg.chars().any(|c| c == ' ' || c == '\t'); + // If an argument has 0 characters then we need to quote it to ensure + // that it actually gets passed through on the command line or otherwise + // it will be dropped entirely when parsed on the other end. + let quote = arg.chars().any(|c| c == ' ' || c == '\t') || arg.len() == 0; if quote { cmd.push_char('"'); } -- cgit 1.4.1-3-g733a5