mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* process.c (rb_f_system): block SIGCHLD during the process
execution, like glibc system(3) does. [ruby-talk:202361] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
45b085a0b2
commit
620bb29f49
2 changed files with 20 additions and 15 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -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:12:14 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (open_ifs_socket): should not use plain malloc.
|
||||
|
|
@ -20,11 +25,6 @@ Tue Jul 18 15:49:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
|
||||
* pack.c (pack_pack): taint 'p' packed strings.
|
||||
|
||||
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
|
||||
|
|
|
|||
25
process.c
25
process.c
|
|
@ -1492,7 +1492,9 @@ rb_f_system(argc, argv)
|
|||
volatile VALUE prog = 0;
|
||||
int pid;
|
||||
int i;
|
||||
RETSIGTYPE (*chfunc)(int);
|
||||
|
||||
chfunc = signal(SIGCHLD, SIG_DFL);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
if (argc == 0) {
|
||||
|
|
@ -1515,8 +1517,9 @@ rb_f_system(argc, argv)
|
|||
SafeStringValue(argv[i]);
|
||||
}
|
||||
retry:
|
||||
switch (pid = fork()) {
|
||||
case 0:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
/* child process */
|
||||
if (argc == 1 && prog == 0) {
|
||||
rb_proc_exec(RSTRING(argv[0])->ptr);
|
||||
}
|
||||
|
|
@ -1524,20 +1527,18 @@ rb_f_system(argc, argv)
|
|||
proc_exec_n(argc, argv, prog);
|
||||
}
|
||||
_exit(127);
|
||||
break; /* not reached */
|
||||
|
||||
case -1:
|
||||
}
|
||||
if (pid < 0) {
|
||||
if (errno == EAGAIN) {
|
||||
rb_thread_sleep(1);
|
||||
goto retry;
|
||||
}
|
||||
rb_sys_fail(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
else {
|
||||
rb_syswait(pid);
|
||||
}
|
||||
if (NIL_P(rb_last_status)) rb_sys_fail(0);
|
||||
signal(SIGCHLD, chfunc);
|
||||
if (pid < 0) rb_sys_fail(0);
|
||||
status = NUM2INT(rb_last_status);
|
||||
#endif
|
||||
|
||||
|
|
@ -1597,6 +1598,10 @@ rb_f_sleep(argc, argv)
|
|||
* Process.getpgrp #=> 25527
|
||||
*/
|
||||
|
||||
#if defined(SIGCLD) && !defined(SIGCHLD)
|
||||
# define SIGCHLD SIGCLD
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
proc_getpgrp()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue