diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | process.c | 18 |
2 files changed, 20 insertions, 10 deletions
@@ -1,3 +1,8 @@ +Tue Jul 18 22:10:13 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * process.c (rb_f_system): block SIGCHLD during the process + execution, like glibc system(3) does. [ruby-talk:202361] + Tue Jul 18 23:10:43 2006 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (open_ifs_socket): should not use plain malloc. @@ -7,7 +12,7 @@ Tue Jul 18 23:10:43 2006 NAKAMURA Usaku <usa@ruby-lang.org> Tue Jul 18 16:52:29 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * eval.c (yield_under_i): argument should be passed in avalue - from. [ruby-dev:29044] + form. [ruby-dev:29044] Tue Jul 18 15:49:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org> @@ -29,11 +34,6 @@ Tue Jul 18 15:19:07 2006 NAKAMURA Usaku <usa@ruby-lang.org> * missing/vsnprintf.c (BSD__uqtoa): new function to support LLP64. all changes are derived from [ruby-dev:29045] -Tue Jul 18 14:38:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org> - - * process.c (rb_f_system): call rb_sys_fail(0) if rb_last_status - is nil. [ruby-talk:202361] - Tue Jul 18 14:03:02 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * lib/webrick/httpserver.rb (WEBrick::HTTPServer::unmount): remove @@ -1583,18 +1583,28 @@ rb_spawn(int argc, VALUE *argv) * * */ +#if defined(SIGCLD) && !defined(SIGCHLD) +# define SIGCHLD SIGCLD +#endif + static VALUE rb_f_system(int argc, VALUE *argv) { int status; + RETSIGTYPE (*chfunc)(int); + chfunc = signal(SIGCHLD, SIG_DFL); status = rb_spawn(argc, argv); - if (status == -1) rb_sys_fail(RSTRING(argv[0])->ptr); + if (status > 0) { #if defined(HAVE_FORK) || defined(HAVE_SPAWNV) - rb_syswait(status); - if (NIL_P(rb_last_status)) rb_sys_fail(0); - status = NUM2INT(rb_last_status); + rb_syswait(status); #endif + } + signal(SIGCHLD, chfunc); + if (status < 0) { + rb_sys_fail(RSTRING(argv[0])->ptr); + } + status = NUM2INT(rb_last_status); if (status == EXIT_SUCCESS) return Qtrue; return Qfalse; } |