windows: fix `subprocess' for an empty argument

An empty argument must be quoted at the CreateProcess() level.

Merge to v5.3
This commit is contained in:
Matthew Flatt 2012-07-25 20:27:00 -06:00
parent 71045e255c
commit df4fed7011
2 changed files with 3 additions and 1 deletions

View File

@ -423,7 +423,7 @@
(if (eq? (system-type) 'windows) (if (eq? (system-type) 'windows)
(lambda (s) (lambda (s)
(let ([split (let loop ([s s]) (let ([split (let loop ([s s])
(let ([m (regexp-match #rx"([^ ]*) (.*)" s)]) (let ([m (regexp-match #rx"([^ ]*) +(.*)" s)])
(if m (if m
(cons (cadr m) (loop (caddr m))) (cons (cadr m) (loop (caddr m)))
(list s))))]) (list s))))])

View File

@ -8622,6 +8622,8 @@ static char *cmdline_protect(char *s)
int ds; int ds;
int has_space = 0, has_quote = 0, was_slash = 0; int has_space = 0, has_quote = 0, was_slash = 0;
if (!*s) return "\"\""; /* quote an empty argument */
for (ds = 0; s[ds]; ds++) { for (ds = 0; s[ds]; ds++) {
if (isspace(s[ds]) || (s[ds] == '\'')) { if (isspace(s[ds]) || (s[ds] == '\'')) {
has_space = 1; has_space = 1;