On Wed, 3 Nov 2004, Shashank Date wrote:

> Hi Zach,
>
> --- Zach Dennis <zdennis / mktec.com> wrote:
>
>> Has there been a way to capture stdout and stderr
>> (most important) on
>> Windows yet?
>
> Will this work for you:
>
> ### After installing open3 package from win32utils
>
> require "win32/open3"
>
> cmd = 'dir a*.vvv'
> fin,fout,ferr = Open3.popen3(cmd)
> fout.each { |line| puts 'OUT:' + line }
> ferr.each { |line| puts 'ERR:' + line }
>
> __END__
>
> ### produces:
>
> OUT: Volume in drive C is LOCAL
> OUT: Volume Serial Number is AC53-D8CC
> OUT:
> OUT: Directory of C:\atest
> OUT:
> ERR:File Not Found
>
> I am on Win2K pro using ruby-one-click installer.
> HTH,

shashank-

any chance i could convice you to try my session module on windows using the
win32/open3 package?  all that you should need to do is

   # require 'open3'
   require 'win32/open3'

in fact, perhaps i'll add this code:

   begin
     require 'open3'
   rescue NameError
     require 'win32/open3'
   end

in any case - all my code relies upon is Open3 - so it should work unmodified.
i'd try this but don't have access to a windows machine.

cheers.

-a
--
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| When you do something, you should burn yourself completely, like a good
| bonfire, leaving no trace of yourself.  --Shunryu Suzuki
===============================================================================