Open.popen3(cmd) generates always Error::PIPE .....

J

Jun Young Kim

[Note: parts of this message were removed to make it a legal post.]

Hi,

The below example code shows all thing I have.

cmd = 'my_command options'

begin
Open.popen3(cmd) do | stdin, stdout, stderr|
while line = stdout.gets
$stdout.write(line)
end
end
rescue => e
STDERR.puts(e)
end

When I execute cmd string in shell, it will be run another ruby
program based on Ruby.Tk.

Anyway, finally, I got alway same error

"Broken Pipe"

;-< I don't understand why this thing was happened.

This is a workaround solution to run this program properly.


cmd = 'my_command options'

begin
Open.popen3(cmd) do | stdin, stdout, stderr|
while line = stdout.gets
$stderr.write(line)
end
end
rescue => e
STDERR.puts(e)
end


When I execute this one, the program is running normally.

Are there nice way I can take ? I dont want use $stderr to just print
out my output ....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top