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

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 …