Hi!
How can I realize two-way pipe?
Regards
Victor V Ismakaev
Hi!
How can I realize two-way pipe?
Regards
Victor V Ismakaev
Hello Victor,
vic ismakaev wrote:
How can I realize two-way pipe?
Maybe this link can help you:
http://rubycentral.com/book/ref_c_io.html#IO.pipe
Cheers,
–
Laurent
This may not be exactly what you are looking for, but maybe it is.
I have been looking for a way to create a read/write interface into
an application such that I can send it commands and read the results.
There seems to be a lot of people asking for this and I have read
a lot of responses on ruby-talk, but most of the threads end before
a final solution is obtained. So far, the link below looks the
most promising:
That’s an old post. I believe popen itself now supports bi-directional
communication natively.
a = IO.popen(“nroff -man”,“w+”)
Thread.new do
while line = gets
a.print line
end
a.close_write
end
while line = a.gets
print “:”, line
end
a.close_read
(This works under Unix for version 1.6.8, I seem to recall that it was fixed
for Windows in 1.7.something)
Regards,
Brian.
On Tue, Apr 22, 2003 at 07:06:38PM +0900, Jim Freeze wrote:
There seems to be a lot of people asking for this and I have read
a lot of responses on ruby-talk, but most of the threads end before
a final solution is obtained. So far, the link below looks the
most promising:
Thanks. This works great! Exactly what I was looking for.
On Tuesday, 22 April 2003 at 19:23:31 +0900, Brian Candler wrote:
On Tue, Apr 22, 2003 at 07:06:38PM +0900, Jim Freeze wrote:
There seems to be a lot of people asking for this and I have read
a lot of responses on ruby-talk, but most of the threads end before
a final solution is obtained. So far, the link below looks the
most promising:That’s an old post. I believe popen itself now supports bi-directional
communication natively.a = IO.popen(“nroff -man”,“w+”)
Thread.new do
while line = gets
a.print line
end
a.close_write
end
while line = a.gets
print “:”, line
end
a.close_read(This works under Unix for version 1.6.8, I seem to recall that it was fixed
for Windows in 1.7.something)
There are people so addicted to exaggeration that they can’t tell the
truth without lying.