From: Wesley J Landaker Date: 2004-01-19T00:26:19+09:00 Subject: Re: running external process? --Boundary-02=_WWqCA6VXupBxfHq Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Description: signed data Content-Disposition: inline On Sunday 18 January 2004 5:39 am, Ferenc Engard wrote: > Hi all, > > Is there a simple way to spawn an external program, feed its stdin, > and get its stdout? > > The problem with popen is, if I want to feed a few MB's of input to > it, then it hangs (I suspect that its stdout IO buffer is full) > before I could read out its stdout on the next line. So, the > following do not work: > > io=3DIO.popen("externalfilter") > io.write(verybigstring) > result=3Dio.read require 'open3' Open3.popen3("externalfilter") { |sin,sout,serr| sin.write(verybigstring) result =3D sout.read } =2D-=20 Wesley J. Landaker - wjl@icecavern.net OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2 --Boundary-02=_WWqCA6VXupBxfHq Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBACqWW8KmKTEzW49IRAnIkAJ0Vd2dbU6GPjP0O42JlmsGNTF9W7gCfchXd OcpyAmJSdkzdgbIEsG4jdsM= =YLkY -----END PGP SIGNATURE----- --Boundary-02=_WWqCA6VXupBxfHq--