platform independent piped input stream from system call

D

Danny Challis

Hi all,
I want to get an input stream from a system command in this manner:

f = open("|ls")
while( [not end of output] )
f.gets
end

but I would like it to be platform independent. The output of the
command I'll be using is massive (hundreds of GB) so I cannot load to
memory or write to a temp file. Is there a good platform-independent way
to do this?

Thanks!

Danny.
 
J

Jeremy Bopp

Hi all,
I want to get an input stream from a system command in this manner:

f = open("|ls")
while( [not end of output] )
f.gets
end

but I would like it to be platform independent. The output of the
command I'll be using is massive (hundreds of GB) so I cannot load to
memory or write to a temp file. Is there a good platform-independent way
to do this?

Check out IO.popen:

http://rdoc.info/stdlib/core/1.9.2/IO.popen

-Jeremy
 
D

Danny Challis

That is exactly what I was looking for! Thank you for pointing me in
the right direction!

Jeremy Bopp wrote in post #971324:
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top