[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

[ANN] win32-open3 0.1.0

djberg96

10/8/2004 6:51:00 PM

Hi all,

We are happy to announce the first release of win32-open3!

What is it?
===========
The Open3 library for Win32, which allows you to use the popen3
method.

This is actually Park Heesob's win32_popen module repackaged. The API
has been altered so that it is identical* to the version currently
distributed in the Ruby standard library.

* Well, it's not quite identical. You can pass an optional second
argument to denote the mode type, either 't' (text) or 'b' (binary).
The default is 'text' mode.

Synopsis
========
require "win32/open3"

cmd = "ver" # or whatever
input, output, error = Open3.popen3(cmd)

input.close # don't need it
err = error.gets # might be nil
if err
puts "Error running command '#{cmd}': " + err.chomp
error.close
output.close
exit
end

# 'ver' actually returns an array of 2 lines (one empty line)
out = output.readlines

puts "Got: " + out.to_s.strip
output.close
error.close

Where is it?
============
You can find it on the project site at
http://www.rubyforge.org/projects/....

The download link is
http://rubyforge.org/frs/download.php/1663/win32-open3...

It can also be found on the RAA (soon - I can't seem to get to it at
the moment to add an entry).

What about open2, open4 and posix_popen?
========================================
These methods are included in Park's win32_popen package, but they
have been removed for the first release of win32-open3. They may be
added back in a later release. The notion of an "Open3.popen4" makes
me wonder if "Open3" was such a good module name after all, but too
late now.

Prerequisites
=============
Ruby 1.8.0 or later
Windows NT family (NT, 2000, XP, etc)

Other notes
===========
This will be in the next release of the Win32Utils installer.

Enjoy!

The Win32Utils Team