1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* internal.h (rb_last_status_clear): declared.

* process.c (rb_last_status_clear): exported.
  (rb_f_system): call rb_last_status_clear.

* io.c (rb_f_backquote): call rb_last_status_clear.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2012-08-29 14:44:08 +00:00
parent 7c854d6d5e
commit e7ddd1fdc3
4 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,12 @@
Wed Aug 29 23:42:59 2012 Tanaka Akira <akr@fsij.org>
* internal.h (rb_last_status_clear): declared.
* process.c (rb_last_status_clear): exported.
(rb_f_system): call rb_last_status_clear.
* io.c (rb_f_backquote): call rb_last_status_clear.
Wed Aug 29 22:01:15 2012 Tanaka Akira <akr@fsij.org> Wed Aug 29 22:01:15 2012 Tanaka Akira <akr@fsij.org>
* process.c (rb_f_system): check failures of waitpid. * process.c (rb_f_system): check failures of waitpid.

View file

@ -222,6 +222,7 @@ struct rb_execarg {
#define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1) #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
rb_pid_t rb_fork_ruby(int *status); rb_pid_t rb_fork_ruby(int *status);
void rb_last_status_clear(void);
/* rational.c */ /* rational.c */
VALUE rb_lcm(VALUE x, VALUE y); VALUE rb_lcm(VALUE x, VALUE y);

1
io.c
View file

@ -7808,6 +7808,7 @@ rb_f_backquote(VALUE obj, VALUE str)
rb_io_t *fptr; rb_io_t *fptr;
SafeStringValue(str); SafeStringValue(str);
rb_last_status_clear();
port = pipe_open_s(str, "r", FMODE_READABLE|DEFAULT_TEXTMODE, NULL); port = pipe_open_s(str, "r", FMODE_READABLE|DEFAULT_TEXTMODE, NULL);
if (NIL_P(port)) return rb_str_new(0,0); if (NIL_P(port)) return rb_str_new(0,0);

View file

@ -226,7 +226,7 @@ rb_last_status_set(int status, rb_pid_t pid)
rb_iv_set(th->last_status, "pid", PIDT2NUM(pid)); rb_iv_set(th->last_status, "pid", PIDT2NUM(pid));
} }
static void void
rb_last_status_clear(void) rb_last_status_clear(void)
{ {
GET_THREAD()->last_status = Qnil; GET_THREAD()->last_status = Qnil;
@ -3656,6 +3656,7 @@ rb_f_system(int argc, VALUE *argv)
#ifdef SIGCHLD #ifdef SIGCHLD
RETSIGTYPE (*chfunc)(int); RETSIGTYPE (*chfunc)(int);
rb_last_status_clear();
chfunc = signal(SIGCHLD, SIG_DFL); chfunc = signal(SIGCHLD, SIG_DFL);
#endif #endif
pid = rb_spawn_internal(argc, argv, NULL, 0); pid = rb_spawn_internal(argc, argv, NULL, 0);