mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
and proc_exec_sh. (rb_proc_exec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf4ecf1d1a
commit
2fb032b74b
2 changed files with 13 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Jun 9 01:24:28 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
|
||||||
|
and proc_exec_sh.
|
||||||
|
(rb_proc_exec): ditto.
|
||||||
|
|
||||||
Sat Jun 9 01:11:07 2012 Tanaka Akira <akr@fsij.org>
|
Sat Jun 9 01:11:07 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* include/ruby/intern.h (rb_exec_arg_init): declaration changed to
|
* include/ruby/intern.h (rb_exec_arg_init): declaration changed to
|
||||||
|
@ -20,8 +26,8 @@ Fri Jun 8 22:39:32 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
Fri Jun 8 19:43:33 2012 Tanaka Akira <akr@fsij.org>
|
Fri Jun 8 19:43:33 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd and
|
* process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd
|
||||||
proc_exec_sh.
|
and proc_exec_sh.
|
||||||
(rb_proc_exec): ditto.
|
(rb_proc_exec): ditto.
|
||||||
|
|
||||||
Fri Jun 8 19:00:59 2012 Tanaka Akira <akr@fsij.org>
|
Fri Jun 8 19:00:59 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
10
process.c
10
process.c
|
@ -1111,7 +1111,6 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif /* __EMX__ */
|
# endif /* __EMX__ */
|
||||||
before_exec(); /* async-signal-safe if forked_child is true */
|
|
||||||
envp = envp_str ? (char **)RSTRING_PTR(envp_str) : NULL;
|
envp = envp_str ? (char **)RSTRING_PTR(envp_str) : NULL;
|
||||||
if (envp_str)
|
if (envp_str)
|
||||||
execve(prog, argv, envp); /* async-signal-safe */
|
execve(prog, argv, envp); /* async-signal-safe */
|
||||||
|
@ -1136,6 +1135,7 @@ proc_exec_sh(const char *str, VALUE envp_str)
|
||||||
rb_notimplement();
|
rb_notimplement();
|
||||||
UNREACHABLE;
|
UNREACHABLE;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
while (*str == ' ' || *str == '\t' || *str == '\n')
|
while (*str == ' ' || *str == '\t' || *str == '\n')
|
||||||
str++;
|
str++;
|
||||||
|
|
||||||
|
@ -1145,7 +1145,6 @@ proc_exec_sh(const char *str, VALUE envp_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
before_exec();
|
|
||||||
rb_w32_spawn(P_OVERLAY, (char *)str, 0);
|
rb_w32_spawn(P_OVERLAY, (char *)str, 0);
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
|
@ -1154,7 +1153,6 @@ proc_exec_sh(const char *str, VALUE envp_str)
|
||||||
char fbuf[MAXPATHLEN];
|
char fbuf[MAXPATHLEN];
|
||||||
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
|
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
|
||||||
int status = -1;
|
int status = -1;
|
||||||
before_exec();
|
|
||||||
if (shell)
|
if (shell)
|
||||||
execl(shell, "sh", "-c", str, (char *) NULL);
|
execl(shell, "sh", "-c", str, (char *) NULL);
|
||||||
else
|
else
|
||||||
|
@ -1163,7 +1161,6 @@ proc_exec_sh(const char *str, VALUE envp_str)
|
||||||
exit(status);
|
exit(status);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
before_exec(); /* async-signal-safe if forked_child is true. */
|
|
||||||
if (envp_str)
|
if (envp_str)
|
||||||
execle("/bin/sh", "sh", "-c", str, (char *)NULL, (char **)RSTRING_PTR(envp_str)); /* async-signal-safe */
|
execle("/bin/sh", "sh", "-c", str, (char *)NULL, (char **)RSTRING_PTR(envp_str)); /* async-signal-safe */
|
||||||
else
|
else
|
||||||
|
@ -2596,8 +2593,10 @@ rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
|
||||||
# define sargp NULL
|
# define sargp NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
before_exec(); /* async-signal-safe if forked_child is true */
|
||||||
|
|
||||||
if (rb_run_exec_options_err(e, sargp, errmsg, errmsg_buflen) < 0) { /* async-signal-safe */
|
if (rb_run_exec_options_err(e, sargp, errmsg, errmsg_buflen) < 0) { /* async-signal-safe */
|
||||||
return -1;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->use_shell) {
|
if (e->use_shell) {
|
||||||
|
@ -2614,6 +2613,7 @@ rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen)
|
||||||
#else
|
#else
|
||||||
# undef sargp
|
# undef sargp
|
||||||
#endif
|
#endif
|
||||||
|
failure:
|
||||||
preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */
|
preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue