[Assigned] PTY.check is broken

Issue #2642 has been updated by Motohiro KOSAKI.

Status changed from Closed to Assigned

I’ve commited r33468 into ruby_1_9_3 as r34183.


Backport #2642: PTY.check is broken

Author: Nobuyoshi N.
Status: Assigned
Priority: Low
Assignee: Yuki S.
Category:
Target version:

=begin
なかだです。

PTY.checkがいろいろと壊れているような気がします。

  • r20298によると PTY.check(pid) to poll program termination. と
    いうことなのに終了まで待ち続ける
  • メソッド本体なのにint statusを返している
  • pid_tを期待するraise_from_check()にVALUEを渡している

Index: ext/pty/pty.c

— ext/pty/pty.c (revision 26395)
+++ ext/pty/pty.c (working copy)
@@ -606,9 +606,9 @@ pty_check(int argc, VALUE *argv, VALUE s

  rb_scan_args(argc, argv, "11", &pid, &exc);
  • cpid = rb_waitpid(NUM2PIDT(pid), &status, WUNTRACED);
  • cpid = rb_waitpid(NUM2PIDT(pid), &status, WNOHANG|WUNTRACED);
    if (cpid == -1) return Qnil;
  • if (!RTEST(exc)) return status;
  • raise_from_check(pid, status);
  • if (!RTEST(exc)) return rb_last_status_get();
  • raise_from_check(cpid, status);
    return Qnil; /* not reached */
    }


— 僕の前にBugはない。
— 僕の後ろにBugはできる。
中田 伸悦
=end