summaryrefslogtreecommitdiff
path: root/ext/pty
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pty')
-rw-r--r--ext/pty/pty.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index f54bbb52e5..ec255cf202 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -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;
}