From: ronald braswell Date: 2007-08-06T02:28:38+09:00 Subject: Bug in Ruby's PTY extension I'm new to the ML so please forgive me if this has been discussed previously. Ruby version: 1.8.5 OS: Solaris 10 x64 (11/06) CPU: Dual core Opteron When using expect or RExpect I was getting an intermittent premature EOFError on the first call to expect. Catching this exception and then going on was an ugly work around. pty.c: I noticed that Solaris 10 does not support TIOCSCTTY so in function establishShell() the child process closes the slave device and reopens it to force it to be the controlling tty. The parent process also closes the slave device because it does not need it. I added a call to nanosleep for 20 milliseconds just before the parent process closes the slave fd at the end of establishShell() and I now both expect and RExpect work reliably. I suspect that just keeping a reference to the open file object in the parent process while the child process closes and reopens the slave device prevents the EOF from occurring -- but I am far from an expert on Solaris internals. This may not be the best way to solve the problem and just adding the small delay does not ensure that the problem will never happen again but so far, so good. Ron _________________________________________________________________ Puzzles, trivia teasers, word scrambles and more. Play for your chance to win! http://club.live.com/home.aspx?icid=CLUB_hotmailtextlink