K
kim jun young
hi, all,
I wanna to execute subprocess and catch subprocess' output from a pipe
in a parent process.
but, unfortunately, a subprocess didn't flush it's output in stdout.
As a result, the parent process cannot recognize what the subprocess
did.
this is a sample code for my case.
clue 1) when I executed "isql -Usybase -P -SHOME_SERVER"
the first prompt of it is
1>
clue 2) in my program, I executed this.
read = IO.popen("isql -Usybase -P -SHOME_SERVER", "r")
puts read.sysread(2)
read.close
also it printout "1>"
clue 3) different case of clue 2
read = IO.popen("isql -Usybase -P -SHOME_SERVER", "r+") # read-write
mode
puts read.sysread(2)
read.close
it doesn't print out anything.
clue 4) different case of clue 2
require "open3"
include Open3
stdin, stdout, stderr = popen3("isql -Usybase -P -SHOME_SERVER")
puts stdout.sysread(1) <-- wait forever.
could you suggest me solution?
I wanna to execute subprocess and catch subprocess' output from a pipe
in a parent process.
but, unfortunately, a subprocess didn't flush it's output in stdout.
As a result, the parent process cannot recognize what the subprocess
did.
this is a sample code for my case.
clue 1) when I executed "isql -Usybase -P -SHOME_SERVER"
the first prompt of it is
1>
clue 2) in my program, I executed this.
read = IO.popen("isql -Usybase -P -SHOME_SERVER", "r")
puts read.sysread(2)
read.close
also it printout "1>"
clue 3) different case of clue 2
read = IO.popen("isql -Usybase -P -SHOME_SERVER", "r+") # read-write
mode
puts read.sysread(2)
read.close
it doesn't print out anything.
clue 4) different case of clue 2
require "open3"
include Open3
stdin, stdout, stderr = popen3("isql -Usybase -P -SHOME_SERVER")
puts stdout.sysread(1) <-- wait forever.
could you suggest me solution?