* process.c (proc_spawn): don't detect simple command line here

because rb_exec_fillarg already did.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-06-05 10:35:47 +00:00
parent e58ec33721
commit e3d685907c
2 changed files with 10 additions and 22 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 5 19:33:51 2012 Tanaka Akira <akr@fsij.org>
* process.c (proc_spawn): don't detect simple command line here
because rb_exec_fillarg already did.
Tue Jun 5 19:21:10 2012 Tanaka Akira <akr@fsij.org>
* process.c (rb_exec_fillarg): bail out a loop eagerly.

View File

@ -1278,30 +1278,13 @@ static rb_pid_t
proc_spawn(char *str)
{
char fbuf[MAXPATHLEN];
char *s, *t;
char **argv, **a;
rb_pid_t status;
VALUE v;
for (s = str; *s; s++) {
if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
before_exec();
status = spawnl(P_NOWAIT, (shell ? shell : "/bin/sh"), "sh", "-c", str, (char*)NULL);
rb_last_status_set(status == -1 ? 127 : status, 0);
after_exec();
return status;
}
}
a = argv = ALLOC_ARGV_WITH_STR((s - str) / 2 + 2, v, s, s - str + 1);
strcpy(s, str);
if (*a++ = strtok(s, " \t")) {
while (t = strtok(NULL, " \t"))
*a++ = t;
*a = NULL;
}
status = argv[0] ? proc_spawn_v(argv, 0) : -1;
ALLOCV_END(v);
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
before_exec();
status = spawnl(P_NOWAIT, (shell ? shell : "/bin/sh"), "sh", "-c", str, (char*)NULL);
rb_last_status_set(status == -1 ? 127 : status, 0);
after_exec();
return status;
}
#endif