about summary refs log tree commit diff
path: root/src/libnative/io
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-08-05 11:49:34 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-08-05 19:54:54 -0700
commit3aec9f46d3fee9c5fa0d44d1ee40e76f8eaec2ed (patch)
tree4a9b983ab8ce7de3c7c2fed5b93b6e21781270ea /src/libnative/io
parentce83301f8c64f77c876ecfed65962b7dc407f093 (diff)
downloadrust-3aec9f46d3fee9c5fa0d44d1ee40e76f8eaec2ed.tar.gz
rust-3aec9f46d3fee9c5fa0d44d1ee40e76f8eaec2ed.zip
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
Diffstat (limited to 'src/libnative/io')
-rw-r--r--src/libnative/io/process.rs5
1 files changed, 4 insertions, 1 deletions
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('"');
         }