From: Christophe Broult Date: 2002-01-10T06:58:14+09:00 Subject: RE: IO.popen not the same as Open3.popen3 ?? This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C19958.B6BA9EE0 Content-Type: text/plain > -----Original Message----- > From: Jim Freeze [mailto:jfreeze@freebsdportal.com] > Sent: Wednesday, January 09, 2002 4:27 PM > To: ruby-talk@ruby-lang.org > Subject: IO.popen not the same as Open3.popen3 ?? > > > Hi: > > I can't seem to get Open3.popen3 to work the same > as IO.popen, ie, I can't get it to accept a command > with commandline arguments. > > Here is the code: > --tester > #! /usr/local/bin/ruby > > require 'open3' > puts "-------- IO.popen() ------------" > puts "`../bsimtran rulefile type in out`" > sout = IO.popen("../bsimtran rulefile type in out", "w+") > sout.each_line { |line| puts line } > sout.close > > puts "-------- Open3.popen3 ------------" > puts "`../bsimtran rulefile type in out`" > sin, sout, serr = Open3.popen3("../bsimtran rulefile type in out", "w+") I believe you should write: sin, sout, serr = Open3.popen3("../bsimtran rulefile type in out") or sin, sout, serr = Open3.popen3("../bsimtran", "rulefile", "type", "in", "out") since there is no parameter to specify the mode. You can have a look at the open3.rb source file or get a copy of The Ruby Way which is an excellent book. Christophe ------_=_NextPart_001_01C19958.B6BA9EE0 Content-Type: text/html Content-Transfer-Encoding: quoted-printable RE: IO.popen not the same as Open3.popen3 ??

> -----Original Message-----
> From: Jim Freeze [mailto:jfreeze@freebsdportal.c= om]
> Sent: Wednesday, January 09, 2002 4:27 = PM
> To: ruby-talk@ruby-lang.org
> Subject: IO.popen not the same as Open3.popen3 = ??
>
>
> Hi:
>
> I can't seem to get Open3.popen3 to work the = same
> as IO.popen, ie, I can't get it to accept a = command
> with commandline arguments.
>
> Here is the code:
> --tester
> #! /usr/local/bin/ruby
>
> require 'open3'
> puts "-------- IO.popen() = ------------"
> puts "`../bsimtran rulefile type in = out`"
> sout =3D IO.popen("../bsimtran rulefile = type in out", "w+")
> sout.each_line { |line| puts line }
> sout.close
>
> puts "-------- Open3.popen3 = ------------"
> puts "`../bsimtran rulefile type in = out`"
> sin, sout, serr =3D = Open3.popen3("../bsimtran rulefile type in out", = "w+")

I believe you should write:

sin, sout, serr =3D Open3.popen3("../bsimtran = rulefile type in out")

or

sin, sout, serr =3D = Open3.popen3("../bsimtran", "rulefile", = "type", "in", "out")

since there is no parameter to specify the = mode.
You can have a look at the open3.rb source file or = get a copy of The Ruby Way
which is an excellent book.

Christophe

------_=_NextPart_001_01C19958.B6BA9EE0--