From df4fed7011b9e9315deb76773be1b34e15f5bf1e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 25 Jul 2012 20:27:00 -0600 Subject: [PATCH] windows: fix `subprocess' for an empty argument An empty argument must be quoted at the CreateProcess() level. Merge to v5.3 --- collects/compiler/private/xform.rkt | 2 +- src/racket/src/port.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/collects/compiler/private/xform.rkt b/collects/compiler/private/xform.rkt index 86059f77b3..bae88fcf5a 100644 --- a/collects/compiler/private/xform.rkt +++ b/collects/compiler/private/xform.rkt @@ -423,7 +423,7 @@ (if (eq? (system-type) 'windows) (lambda (s) (let ([split (let loop ([s s]) - (let ([m (regexp-match #rx"([^ ]*) (.*)" s)]) + (let ([m (regexp-match #rx"([^ ]*) +(.*)" s)]) (if m (cons (cadr m) (loop (caddr m))) (list s))))]) diff --git a/src/racket/src/port.c b/src/racket/src/port.c index 890e9dbd89..2107b8aac4 100644 --- a/src/racket/src/port.c +++ b/src/racket/src/port.c @@ -8622,6 +8622,8 @@ static char *cmdline_protect(char *s) int ds; int has_space = 0, has_quote = 0, was_slash = 0; + if (!*s) return "\"\""; /* quote an empty argument */ + for (ds = 0; s[ds]; ds++) { if (isspace(s[ds]) || (s[ds] == '\'')) { has_space = 1;