[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

IO.popen and gets

unbewust

8/31/2007 2:07:00 PM

in order to get the answer of rsync when doing a backup with ruby, i
make use of IO.pope like that :

f = IO.popen("#{RSYNC} -a#{verboseStr} #{progressStr} --eahfs
\"#{i.path}\" \"#{@usbkey.stringValue.to_s}\"", "r")
while( r = f.gets ) do
log( "#{r}" )
end

it works but not the way i'd like to get.

if i do :
#{RSYNC} -a#{verboseStr} #{progressStr} --eahfs \"#{i.path}\"
\"#{@usbkey.stringValue.to_s}\"

on a terminal, i get each line, given by rsync, at a time thru Ruby it
isn't exactly the same, i get the whole lines at a time, thought i'd
prefer one after each other avoiding the user to be bored, because it
sees something ...

may be i'm wrong somewhere with this part :

while( r = f.gets ) do
log( "#{r}" )
end


???