small medium large xlarge

Profile_pragsmall
01 Dec 2011, 13:42
Geoffrey Clements (22 posts)

Open3.capture3 is something I didn’t know about and is a great help when running commands. But some tools display progress and it would be nice to show that progress. For instance

rsync -av foo:~/suff/* stuff/

run on the command line displays information of what it’s is doing. On the other hand

stdout_str, stderr_str, status = Open3.capture3(‘rsync -av foo:~/suff/* stuff/’)

prints nothing to the screen. It would be nice to have a way of displaying rsync’s progress when executed from within a ruby script.

thanks,

Dmfcb_pragsmall
02 Dec 2011, 12:52
David Copeland (489 posts)

@Open3@ provides several other methods that let you do what you are talking about, such as @popen3@, which will give you pipes for the standard error and standard out. Check out the rubydoc here : http://www.ruby-doc.org/stdlib-1.9.3/libdoc/open3/rdoc/Open3.html#method-c-popen3

Note that you might need to set @sync@ to true on the pipes you’re given.

Profile_pragsmall
02 Dec 2011, 13:33
Geoffrey Clements (22 posts)

Cool! How about an example in the book? :D

Dmfcb_pragsmall
02 Dec 2011, 17:45
David Copeland (489 posts)

That may have to wait for the second edition; it’s hard to fit everything in…

You must be logged in to comment