James Gray
4/20/2009 2:43:00 AM
On Apr 19, 2009, at 9:17 PM, Jun Young Kim wrote:
> The program I want to execute as a external program in ruby is using
> a write system call.
>
> When I use IO.popen or IO.pipe, there is no output because of the
> external program didn't flush it's output. (but, when I executed it
> in shell, normally it shows up outputs).
Try doing it this way:
output = IO.popen("command here", "w+") { |cmd|
cmd.close_write
cmd.read
}
A lot of times, closing the writing stream will trigger the output.
Hope that helps.
James Edward Gray II