[前][次][番号順一覧][スレッド一覧]

ruby-changes:34048

From: nobu <ko1@a...>
Date: Mon, 26 May 2014 13:35:28 +0900 (JST)
Subject: [ruby-changes:34048] nobu:r46129 (trunk): pty.c: do nothing if terminated already

nobu	2014-05-26 13:35:17 +0900 (Mon, 26 May 2014)

  New Revision: 46129

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=46129

  Log:
    pty.c: do nothing if terminated already
    
    * ext/pty/pty.c (pty_detach_process): if the child process has
      terminated already, return immediately without starting a thread
      to detach it.

  Modified files:
    trunk/ext/pty/pty.c
Index: ext/pty/pty.c
===================================================================
--- ext/pty/pty.c	(revision 46128)
+++ ext/pty/pty.c	(revision 46129)
@@ -538,6 +538,11 @@ pty_open(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/pty/pty.c#L538
 static VALUE
 pty_detach_process(struct pty_info *info)
 {
+#ifdef WNOHANG
+    int st;
+    if (rb_waitpid(info->child_pid, &st, WNOHANG) <= 0)
+	return Qnil;
+#endif
     rb_detach_process(info->child_pid);
     return Qnil;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]