From: "U.Nakamura" Date: 2007-02-05T22:31:04+09:00 Subject: [ruby-dev:30264] Re: [ruby-cvs:18879] Ruby:r11631: * eval_thread.c, common.mk: remove eval_thread.c. こんにちは、なかむら(う)です。 In message "[ruby-cvs:18879] Ruby:r11631: * eval_thread.c, common.mk: remove eval_thread.c." on Feb.05,2007 21:21:02, wrote: | * io.c (pipe_finalize): TODO: comment out last_status. | * process.c, yarvcore.h: fix to use yarv_vm_t#last_status instead of | rb_last_status and make last_status_get() to access $?. ext/pty/pty.cとwin32/win32.cでrb_last_statusを使ってます。 それとio.cのTODOとを考え合わせると、アクセスする関数を外部に 提供するべきではないでしょうか。 Index: intern.h =================================================================== --- intern.h (revision 11632) +++ intern.h (working copy) @@ -413,6 +413,8 @@ ID rb_compose_ivar2(ID, VALUE); ID rb_decompose_ivar2(ID, VALUE*); /* process.c */ +void rb_last_status_set(int, int); +VALUE rb_last_status_get(void); struct rb_exec_arg { int argc; VALUE *argv; Index: io.c =================================================================== --- io.c (revision 11632) +++ io.c (working copy) @@ -2979,7 +2979,7 @@ #if defined DJGPP status <<= 8; #endif - /* TODO: need it? -> rb_last_status = INT2FIX(status); */ + rb_last_status_set(status, fptr->pid); #else fptr_finalize(fptr, noraise); #endif Index: ext/pty/pty.c =================================================================== --- ext/pty/pty.c (revision 11632) +++ ext/pty/pty.c (working copy) @@ -135,13 +135,12 @@ static void raise_from_wait(char *state, struct pty_info *info) { - extern VALUE rb_last_status; char buf[1024]; VALUE exc; snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)info->child_pid); exc = rb_exc_new2(eChildExited, buf); - rb_iv_set(exc, "status", rb_last_status); + rb_iv_set(exc, "status", rb_last_status_get()); rb_funcall(info->thread, rb_intern("raise"), 1, exc); } Index: win32/win32.c =================================================================== --- win32/win32.c (revision 11632) +++ win32/win32.c (working copy) @@ -837,8 +837,6 @@ return ret; } -extern VALUE rb_last_status; - int rb_w32_spawn(int mode, const char *cmd, const char *prog) { @@ -863,7 +861,7 @@ switch (mode) { case P_WAIT: rb_syswait(child->pid); - return NUM2INT(rb_last_status); + return NUM2INT(rb_iv_get(rb_last_status_get(), "status")); case P_NOWAIT: return child->pid; case P_OVERLAY: それでは。 -- U.Nakamura