From: Ehsanul Hoque Date: 2009-09-11T18:35:09+09:00 Subject: Re: Can not catch PTY::ChildExited exception --_8f19e65f-ac1e-418a-a396-f40fc7a7add8_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Denis=2C That's a good reason=2C exactly the same reason I needed to find out so muc= h about PTY in fact.=20 As for Process.wait=2C as long as you have the pid=2C it should work. I tri= ed it out in irb now=2C and it seems to work. But you will get the child ex= ited exception still. I hadn't thought of this in my explanation=2C it's de= finitely a better way to wait for the process to finish compared to my "t.j= oin". Here's what I tried in irb: def test a=2Cb=2Cpid =3D PTY.spawn("sleep 5") Process.wait(pid) end test > Date: Fri=2C 11 Sep 2009 17:12:27 +0900 > From: denis.berezhnoy@gmail.com > Subject: Re: Can not catch PTY::ChildExited exception > To: ruby-talk@ruby-lang.org >=20 > Denis Berezhnoy wrote: > > Ehsanul Hoque wrote: > >> Well=2C I'm sure I have nowhere as good an idea of PTY.spawn() as=20 > >> Matsumoto does=2C but let me try to explain what your code is doing=2C= and=20 > >> how to get your desired result. > >>=20 > >> First=2C you might want to consider using other methods for what you'r= e=20 > >> doing. You probably don't really need a pseudo terminal=2C which is wh= at=20 > >> PTY gives you=2C and you can use more well documented methods.=20 > >=20 > > Hi Ehsan=2C > >=20 > > Thanks for detailed explanation. The reason why I use PTY is because I > > need to interact with application that does not flush its output to > > pipe. So when I use IO.popen or IO.pipe there is no output. > >=20 > > PTY.spawn() solves this problem so I use it intentionally. > >=20 > > Best regards=2C > > Denis >=20 > Hi Ehsan=2C >=20 > One more question. Can I use Process.wait to wait for termination of=20 > the process which was run by PTY.spawn? >=20 > Best regards=2C > Denis > --=20 > Posted via http://www.ruby-forum.com/. >=20 _________________________________________________________________ Get back to school stuff for them and cashback for you. http://www.bing.com/cashback?form=3DMSHYCB&publ=3DWLHMTAG&crea=3DTEXT_MSHYC= B_BackToSchool_Cashback_BTSCashback_1x1= --_8f19e65f-ac1e-418a-a396-f40fc7a7add8_--