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:
parent
fba33accdb
commit
00f78058b6
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue