From: Tim Kynerd Date: 2003-02-16T05:21:25+09:00 Subject: Re: Capturing output from Kernel#system On Sat, 15 Feb 2003 18:32:06 +0100, Tim Kynerd wrote: > Maybe I'm dumb, I dunno. > > I need to execute an external command and capture the output from it in a > Ruby structure. > > When I use the Kernel#system method to do this, I get the output just > fine, but I can't figure out how to capture it. The method returns true, > of course, but obviously true isn't what I want to capture! > > I'd like to avoid the obvious kludge of writing the command output to a > file and reading the file in Ruby. Isn't there a better way than that? The > pickaxe book isn't helping me here at all (maybe I didn't look where I > should have...). > > Thanks for any help you can provide. Fished around a little more in the pickaxe book and discovered the IO#popen method, which does the trick. Verrrrrry interesting.... -- Tim Kynerd Sundbyberg (sm�stan i storstan), Sweden tim@tram.nu Sunrise in Stockholm today: 7:31 Sunset in Stockholm today: 16:31 My rail transit photos at http://www.kynerd.nu