* process.c (rb_exec_err): after_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@35963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-06-08 10:57:10 +00:00
Родитель 86c82ad647
Коммит c17c8ebb14
2 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,9 @@
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
proc_exec_sh.
(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>
* process.c (ARGV_COUNT): unused macro removed. * process.c (ARGV_COUNT): unused macro removed.

Просмотреть файл

@ -1117,8 +1117,7 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
execve(prog, argv, envp); /* async-signal-safe */ execve(prog, argv, envp); /* async-signal-safe */
else else
execv(prog, argv); /* async-signal-safe */ execv(prog, argv); /* async-signal-safe */
preserving_errno(try_with_sh(prog, argv, envp); /* try_with_sh() is async-signal-safe. */ preserving_errno(try_with_sh(prog, argv, envp)); /* try_with_sh() is async-signal-safe. */
after_exec()); /* after_exec() is not async-signal-safe */
# if defined(__EMX__) || defined(OS2) # if defined(__EMX__) || defined(OS2)
if (new_argv) { if (new_argv) {
xfree(new_argv[0]); xfree(new_argv[0]);
@ -1148,7 +1147,6 @@ proc_exec_sh(const char *str, VALUE envp_str)
#ifdef _WIN32 #ifdef _WIN32
before_exec(); before_exec();
rb_w32_spawn(P_OVERLAY, (char *)str, 0); rb_w32_spawn(P_OVERLAY, (char *)str, 0);
after_exec();
return -1; return -1;
#else #else
#if defined(__CYGWIN32__) || defined(__EMX__) #if defined(__CYGWIN32__) || defined(__EMX__)
@ -1161,7 +1159,6 @@ proc_exec_sh(const char *str, VALUE envp_str)
execl(shell, "sh", "-c", str, (char *) NULL); execl(shell, "sh", "-c", str, (char *) NULL);
else else
status = system(str); status = system(str);
after_exec();
if (status != -1) if (status != -1)
exit(status); exit(status);
} }
@ -1171,7 +1168,6 @@ proc_exec_sh(const char *str, VALUE 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
execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe */ execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe */
preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */
#endif #endif
return -1; return -1;
#endif /* _WIN32 */ #endif /* _WIN32 */
@ -1181,7 +1177,9 @@ proc_exec_sh(const char *str, VALUE envp_str)
int int
rb_proc_exec(const char *str) rb_proc_exec(const char *str)
{ {
return proc_exec_sh(str, Qfalse); int ret = proc_exec_sh(str, Qfalse);
preserving_errno(after_exec());
return ret;
} }
enum { enum {
@ -2615,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
preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */
return -1; return -1;
} }