mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c717d6a58
commit
ac8a2a31c2
3 changed files with 44 additions and 5 deletions
|
@ -357,7 +357,7 @@ isInternalCmd(char *cmd)
|
|||
int vecc = NtMakeCmdVector(cmd, &vec, FALSE);
|
||||
|
||||
for( i = 0; szInternalCmds[i] ; i++){
|
||||
if(!strcmp(szInternalCmds[i], vec[0])){
|
||||
if(!strcasecmp(szInternalCmds[i], vec[0])){
|
||||
fRet = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -735,6 +735,8 @@ char *cmd;
|
|||
int status = -1;
|
||||
char *shell, *cmd2;
|
||||
int mode = NtSyncProcess ? P_WAIT : P_NOWAIT;
|
||||
char quote;
|
||||
char *exec;
|
||||
|
||||
/* save an extra exec if possible */
|
||||
if ((shell = getenv("RUBYSHELL")) != 0) {
|
||||
|
@ -778,20 +780,47 @@ char *cmd;
|
|||
a = argv;
|
||||
for (s = cmd2; *s;) {
|
||||
while (*s && isspace(*s)) s++;
|
||||
if (*s)
|
||||
if (*s == '"') {
|
||||
quote = *s;
|
||||
*(a++) = s++;
|
||||
while (*s) {
|
||||
if (*s == '\\' && *(s + 1) == quote) {
|
||||
memmove(s, s + 1, strlen(s) + 1);
|
||||
s++;
|
||||
}
|
||||
else if (*s == quote) {
|
||||
s++;
|
||||
break;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
||||
else if (*s) {
|
||||
*(a++) = s;
|
||||
while (*s && !isspace(*s)) s++;
|
||||
while (*s && !isspace(*s)) s++;
|
||||
}
|
||||
if (*s)
|
||||
*s++ = '\0';
|
||||
}
|
||||
*a = NULL;
|
||||
exec = NULL;
|
||||
if (argv[0]) {
|
||||
if ((status = spawnvpe(mode, argv[0], argv, environ)) == -1) {
|
||||
exec = ALLOC_N(char, (strlen(argv[0]) + 1));
|
||||
if (argv[0][0] == '"' && argv[0][strlen(argv[0]) - 1] == '"') {
|
||||
strcpy(exec, &argv[0][1]);
|
||||
exec[strlen(exec) - 1] = '\0';
|
||||
}
|
||||
else {
|
||||
strcpy(exec, argv[0]);
|
||||
}
|
||||
if ((status = spawnvpe(mode, exec, argv, environ)) == -1) {
|
||||
free(exec);
|
||||
free(argv);
|
||||
free(cmd2);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(exec);
|
||||
free(cmd2);
|
||||
free(argv);
|
||||
return (int)((status & 0xff) << 8);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue