IO redirection

Basically, I need to redirect the results of exec. While I can
$stdout.reopen(file), and I can redefine $stdout to anything with a
`write' method, I seem to be unable to send the results of exec to
anything within my script (so exec('echo','1') would send "1\n" to a
method). I tried to subclass IO, but then I get
:in `reopen': uninitialized stream (IOError)

Any ideas?

Daniel Brumbaugh Keeney

Hi,

Use

p exec('echo', '1')

instead of
exec('echo', '1')

And you will get '1\n' in the specified file.

Thank you.

Daniel Brumbaugh Keeney wrote:

ยทยทยท

Basically, I need to redirect the results of exec. While I can
$stdout.reopen(file), and I can redefine $stdout to anything with a
`write' method, I seem to be unable to send the results of exec to
anything within my script (so exec('echo','1') would send "1\n" to a
method). I tried to subclass IO, but then I get
:in `reopen': uninitialized stream (IOError)

Any ideas?

Daniel Brumbaugh Keeney

--------------------------------------
Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
http://pr.mail.yahoo.co.jp/toolbar/