From: Axel Etzold Date: 2008-05-27T07:37:50+09:00 Subject: Re: How to catch STDIO STREAM? -------- Original-Nachricht -------- > Datum: Tue, 27 May 2008 07:21:55 +0900 > Von: Cheyne Li > An: ruby-talk@ruby-lang.org > Betreff: Re: How to catch STDIO STREAM? > Thank you for your information. I tried, but it only give me result like > # > > So, is there a way to convert it into string? > Dear Cheyne, yes, there is. Use readlines, like this: ------------------------------- require "open3" filenames=%w[file1 file2 file3] inp,out,err=Open3.popen3("xargs","ls","-l") filenames.each{|f| inp.puts f} inp.close output=out.readlines errout=err.readlines puts "sent #{filenames.size} lines of input" puts "got back #{output.size} lines of output" puts "these were the errors, if any:" puts errout ----------------------------------- Best regards, Axel > > Axel Etzold wrote: > > -------- Original-Nachricht -------- > >> Datum: Tue, 27 May 2008 06:52:55 +0900 > >> Von: Cheyne Li > >> An: ruby-talk@ruby-lang.org > >> Betreff: How to catch STDIO STREAM? > > > >> -- > >> Posted via http://www.ruby-forum.com/. > > > > Dear Cheyne, > > > > have a look at this: > > > > http://www.ruby-doc.org/stdlib/libdoc/open3/rdoc/index.html > > > > Best regards, > > > > Axel > > -- > Posted via http://www.ruby-forum.com/. -- Psssst! Schon vom neuen GMX MultiMessenger geh�rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger