mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* process.c: fix to use rb_status_line_set/get/clear().
* eval_intern.h: fix line break. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c574383a4
commit
ea2dd2e805
3 changed files with 26 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Feb 8 15:43:05 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* process.c: fix to use rb_status_line_set/get/clear().
|
||||||
|
|
||||||
|
* eval_intern.h: fix line break.
|
||||||
|
|
||||||
Thu Feb 8 15:00:14 2007 Koichi Sasada <ko1@atdot.net>
|
Thu Feb 8 15:00:14 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
|
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
|
||||||
|
|
|
@ -183,10 +183,10 @@ char *strrchr _((const char *, const char));
|
||||||
{ \
|
{ \
|
||||||
ruby_cref()->nd_visi = (f); \
|
ruby_cref()->nd_visi = (f); \
|
||||||
}
|
}
|
||||||
|
|
||||||
extern VALUE exception_error;
|
extern VALUE exception_error;
|
||||||
extern VALUE sysstack_error;
|
extern VALUE sysstack_error;
|
||||||
|
|
||||||
|
|
||||||
void rb_thread_cleanup _((void));
|
void rb_thread_cleanup _((void));
|
||||||
void rb_thread_wait_other_threads _((void));
|
void rb_thread_wait_other_threads _((void));
|
||||||
|
|
||||||
|
|
30
process.c
30
process.c
|
@ -197,6 +197,12 @@ get_ppid(void)
|
||||||
|
|
||||||
static VALUE rb_cProcStatus;
|
static VALUE rb_cProcStatus;
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_last_status_get(void)
|
||||||
|
{
|
||||||
|
return GET_VM()->last_status;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_last_status_set(int status, rb_pid_t pid)
|
rb_last_status_set(int status, rb_pid_t pid)
|
||||||
{
|
{
|
||||||
|
@ -206,10 +212,11 @@ rb_last_status_set(int status, rb_pid_t pid)
|
||||||
rb_iv_set(vm->last_status, "pid", INT2FIX(pid));
|
rb_iv_set(vm->last_status, "pid", INT2FIX(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
static void
|
||||||
rb_last_status_get(void)
|
rb_last_status_clear(void)
|
||||||
{
|
{
|
||||||
return GET_VM()->last_status;
|
rb_vm_t *vm = GET_VM();
|
||||||
|
vm->last_status = Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -643,7 +650,7 @@ static int
|
||||||
waitall_each(int pid, int status, VALUE ary)
|
waitall_each(int pid, int status, VALUE ary)
|
||||||
{
|
{
|
||||||
rb_last_status_set(status, pid);
|
rb_last_status_set(status, pid);
|
||||||
rb_ary_push(ary, rb_assoc_new(INT2NUM(pid), GET_VM()->last_status));
|
rb_ary_push(ary, rb_assoc_new(INT2NUM(pid), rb_last_status_get());
|
||||||
return ST_DELETE;
|
return ST_DELETE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -728,7 +735,8 @@ proc_wait(int argc, VALUE *argv)
|
||||||
if ((pid = rb_waitpid(pid, &status, flags)) < 0)
|
if ((pid = rb_waitpid(pid, &status, flags)) < 0)
|
||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
return GET_VM()->last_status = Qnil;
|
rb_last_status_clear();
|
||||||
|
return Qnil;
|
||||||
}
|
}
|
||||||
return INT2FIX(pid);
|
return INT2FIX(pid);
|
||||||
}
|
}
|
||||||
|
@ -756,7 +764,7 @@ proc_wait2(int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE pid = proc_wait(argc, argv);
|
VALUE pid = proc_wait(argc, argv);
|
||||||
if (NIL_P(pid)) return Qnil;
|
if (NIL_P(pid)) return Qnil;
|
||||||
return rb_assoc_new(pid, GET_VM()->last_status);
|
return rb_assoc_new(pid, rb_last_status_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -805,10 +813,10 @@ proc_waitall(void)
|
||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
}
|
}
|
||||||
rb_last_status_set(status, pid);
|
rb_last_status_set(status, pid);
|
||||||
rb_ary_push(result, rb_assoc_new(INT2NUM(pid), GET_VM()->last_status));
|
rb_ary_push(result, rb_assoc_new(INT2NUM(pid), rb_last_status_get()));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GET_VM()->last_status = Qnil;
|
rb_last_status_clear();
|
||||||
for (pid = -1;;) {
|
for (pid = -1;;) {
|
||||||
pid = rb_waitpid(-1, &status, 0);
|
pid = rb_waitpid(-1, &status, 0);
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
|
@ -816,7 +824,7 @@ proc_waitall(void)
|
||||||
break;
|
break;
|
||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
}
|
}
|
||||||
rb_ary_push(result, rb_assoc_new(INT2NUM(pid), GET_VM()->last_status));
|
rb_ary_push(result, rb_assoc_new(INT2NUM(pid), rb_last_status_get()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
|
@ -829,7 +837,7 @@ detach_process_watcher(int *pid_p)
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
cpid = rb_waitpid(*pid_p, &status, WNOHANG);
|
cpid = rb_waitpid(*pid_p, &status, WNOHANG);
|
||||||
if (cpid != 0) return GET_VM()->last_status;
|
if (cpid != 0) return rb_last_status_get();
|
||||||
rb_thread_sleep(1);
|
rb_thread_sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1610,7 +1618,7 @@ rb_f_system(int argc, VALUE *argv)
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
rb_sys_fail(RSTRING_PTR(argv[0]));
|
rb_sys_fail(RSTRING_PTR(argv[0]));
|
||||||
}
|
}
|
||||||
status = NUM2INT(GET_VM()->last_status);
|
status = NUM2INT(rb_last_status_get());
|
||||||
if (status == EXIT_SUCCESS) return Qtrue;
|
if (status == EXIT_SUCCESS) return Qtrue;
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue