# Re: Bug in Ruby's PTY extension

**URL:** <https://www.ruby-forum.com/t/re-bug-in-rubys-pty-extension/111383>\
**Category:** Ruby\
**Created:** [August 6, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/re-bug-in-rubys-pty-extension/111383 "2007-08-06T18:21:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronald\_braswell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f9ae1b/32.png) [@ronald\_braswell](https://www.ruby-forum.com/u/ronald_braswell)\
**Post date:** [August 6, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/re-bug-in-rubys-pty-extension/111383/1 "2007-08-06T18:21:46Z")

</div>

> > previously.
> > 
> > suspect that just keeping a reference to the open file object in the
> 
> Regards,
> 
> Dan

Hi Dan,

The child process inherits open file descriptors for the pty master and  
slave devices – neither of which were the controlling terminal for any  
process. In order for the pty slave device to become the controlling  
terminal for the child process, the child process needs to call  
TIOCSCTTY  
(not supported for Solaris) or, as you have pointed out, needs to close  
the  
pty slave and reopen it (after calling setsid()). Had Solaris  
supported  
TIOCSCTTY the problem that I experienced probably would not have occured  
since the close/open would not have been necessary.

Regards,

Ron
