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

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-26 04:35:17 +00:00
parent fba33accdb
commit 00f78058b6

View file

@ -538,6 +538,11 @@ pty_open(VALUE klass)
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;
}