summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-05 16:25:55 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-05 16:25:55 +0000
commit05ea0b76e6425003f994376f999a489f82edda98 (patch)
treeb208ac9f6ab5d00050d2a0f7052bf028f2f704d6 /win32/win32.c
parentb6367d64f400ee44eb2baf309924949e987d6d16 (diff)
* win32/win32.c (CreateChild): need to quote cmd if RUBYSHELL is set.
* win32/win32.c (CreateChild): fix condition about whether to call shell or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c
index b7827218ad..0e75f431a1 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -910,23 +910,28 @@ CreateChild(char *cmd, char *prog, SECURITY_ATTRIBUTES *psa, HANDLE hInput, HAND
dwCreationFlags = (NORMAL_PRIORITY_CLASS);
- shell = NULL;
if (prog) {
shell = prog;
}
- else if (has_redirection(cmd)) {
- if (shell = getenv("RUBYSHELL")) {
+ else {
+ int redir = -1;
+ if ((shell = getenv("RUBYSHELL")) && (redir = has_redirection(cmd))) {
char *tmp = ALLOCA_N(char, strlen(shell) + strlen(cmd) +
- sizeof (" -c "));
- sprintf(tmp, "%s -c %s", shell, cmd);
+ sizeof (" -c ") + 2);
+ sprintf(tmp, "%s -c \"%s\"", shell, cmd);
cmd = tmp;
}
- else if ((shell = getenv("COMSPEC")) && isInternalCmd(cmd, shell)) {
+ else if ((shell = getenv("COMSPEC")) &&
+ ((redir < 0 ? has_redirection(cmd) : redir) ||
+ isInternalCmd(cmd, shell))) {
char *tmp = ALLOCA_N(char, strlen(shell) + strlen(cmd) +
sizeof (" /c "));
sprintf(tmp, "%s /c %s", shell, cmd);
cmd = tmp;
}
+ else {
+ shell = NULL;
+ }
}
RUBY_CRITICAL({