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
This commit is contained in:
parent
ce83301f8c
commit
3aec9f46d3
6 changed files with 61 additions and 11 deletions
|
|
@ -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('"');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue