win32-open3 0.3.1-x86-mswin32-60 → 0.3.2-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +81 -75
- data/MANIFEST +10 -10
- data/README +64 -62
- data/Rakefile +98 -0
- data/doc/open3.txt +79 -79
- data/examples/win32_open3_example.rb +34 -0
- data/ext/win32/open3.c +567 -546
- data/lib/win32/open3.so +0 -0
- data/test/test_win32_open3.rb +113 -113
- data/win32-open3.gemspec +36 -0
- metadata +15 -12
data/CHANGES
CHANGED
@@ -1,75 +1,81 @@
|
|
1
|
-
== 0.3.
|
2
|
-
* Updated the
|
3
|
-
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
* Added
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
*
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
*
|
23
|
-
|
24
|
-
== 0.2.
|
25
|
-
* Fixed a bug
|
26
|
-
go to
|
27
|
-
*
|
28
|
-
*
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
*
|
34
|
-
|
35
|
-
|
36
|
-
*
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
*
|
42
|
-
*
|
43
|
-
*
|
44
|
-
|
45
|
-
== 0.2.
|
46
|
-
*
|
47
|
-
|
48
|
-
*
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
*
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
*
|
1
|
+
== 0.3.2 - 23-Jan-2010
|
2
|
+
* Updated the gemspec. The required version is now any version less
|
3
|
+
than 1.9.x. This library is for the 1.8.x branch only.
|
4
|
+
* The Rakefile now handles the gem building and installation and some
|
5
|
+
existing tasks were refactored.
|
6
|
+
|
7
|
+
== 0.3.1 - 23-Jun-2009
|
8
|
+
* Updated the license to Artistic 2.0
|
9
|
+
* Set the license in the gemspec.
|
10
|
+
* Added note regarding 1.9.x in the open3.txt file.
|
11
|
+
|
12
|
+
== 0.3.0 - 22-Jun-2009
|
13
|
+
* Fixed an issue where the block form of the Open3.popen3 method did not
|
14
|
+
return the exit value.
|
15
|
+
* Fixed the version number.
|
16
|
+
* Added a test to validate the exit value in block form.
|
17
|
+
* Updated the gemspec description.
|
18
|
+
|
19
|
+
== 0.2.9 - 8-Mar-2009
|
20
|
+
* Fixed a bug within an internal function that could cause an exception.
|
21
|
+
Thanks go to Ross Bunker for the spot and patch.
|
22
|
+
* Fixed the release dates for 0.2.7 and 0.2.8 (2009, not 2008).
|
23
|
+
|
24
|
+
== 0.2.8 - 27-Feb-2009
|
25
|
+
* Fixed a potential bug where nil might be returned instead of an actual
|
26
|
+
Process::Status object. Thanks go to Benny Bach for the spot.
|
27
|
+
* The 'test' Rake task now runs the 'clean' task after the fact.
|
28
|
+
* Some updates to the README about precompiled binaries.
|
29
|
+
|
30
|
+
== 0.2.7 - 11-Jan-2009
|
31
|
+
* Fixed a bug that could cause exitstatus to return bogus information. Thanks
|
32
|
+
go to Roman Zawada for the spot.
|
33
|
+
* Added a 'build_binary_gem' Rake task.
|
34
|
+
* Updates to the gemspec, including the addition of Park Heesob as the primary
|
35
|
+
author in the gemspec.
|
36
|
+
* Renamed the test file and the example file.
|
37
|
+
|
38
|
+
== 0.2.6 - 1-June-2007
|
39
|
+
* Fixed RubyForge bug #20455 (closed IO stream). Thanks go an anonymous user
|
40
|
+
for the spot.
|
41
|
+
* Added a Rakefile with tasks for building, testing and installation.
|
42
|
+
* Minor updates to the test file.
|
43
|
+
* Some minor rdoc improvements.
|
44
|
+
|
45
|
+
== 0.2.5 - 8-Dec-2006
|
46
|
+
* Added a WIN32_OPEN3_VERSION constant.
|
47
|
+
* Fixes and updates to the gemspec.
|
48
|
+
* Some internal reorganization.
|
49
|
+
* Minor documentation updates and corrections.
|
50
|
+
|
51
|
+
== 0.2.4 - 4-Jun-2006
|
52
|
+
* Applied a patch for Windows 2000. Thanks again to John-Mason Shackelford
|
53
|
+
for the patch.
|
54
|
+
* Fixed the version number for the last release.
|
55
|
+
|
56
|
+
== 0.2.3 - 3-Jun-2006
|
57
|
+
* Now sets Process::Status when the block form is used. Thanks go to
|
58
|
+
Samuel Tesla and John-Mason Shackelford for their patches.
|
59
|
+
* Improved error messages.
|
60
|
+
* Documentation updated with regards to the block form of the method calls.
|
61
|
+
* Some internal reorganization that you don't care about.
|
62
|
+
|
63
|
+
== 0.2.2 - 10-Feb-2006
|
64
|
+
* Methods now support block form, and all handles are automatically closed
|
65
|
+
at the end of the block (via ensure).
|
66
|
+
|
67
|
+
== 0.2.1 - 27-Oct-2005
|
68
|
+
* Added a type check in the extconf.rb file and did some type mangling in
|
69
|
+
order to handle rb_pid_t in a backwards compatible way. In other words,
|
70
|
+
you need this version to work with 1.8.3 or later.
|
71
|
+
|
72
|
+
== 0.2.0 - 9-Jan-2005
|
73
|
+
* Added the Open4 module and popen4 method. Thanks go to Aslak Hellesoy for
|
74
|
+
the patch.
|
75
|
+
* Added an optional 3rd parameter - the "show" flag. See docs for details.
|
76
|
+
* Made some documentation more rdoc friendly.
|
77
|
+
* Moved the "examples" directory to the toplevel directory.
|
78
|
+
* Added some information to the README file about possible compiler problems.
|
79
|
+
|
80
|
+
== 0.1.0 - 8-Oct-2004
|
81
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* MANIFEST
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* win32-open3.gemspec
|
6
|
-
* doc/open3.txt
|
7
|
-
* examples/open3_test.rb
|
8
|
-
* ext/extconf.rb
|
9
|
-
* ext/win32/open3.c
|
10
|
-
* ext/win32/open3.h
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-open3.gemspec
|
6
|
+
* doc/open3.txt
|
7
|
+
* examples/open3_test.rb
|
8
|
+
* ext/extconf.rb
|
9
|
+
* ext/win32/open3.c
|
10
|
+
* ext/win32/open3.h
|
11
11
|
* test/test_win32_open3.rb
|
data/README
CHANGED
@@ -1,62 +1,64 @@
|
|
1
|
-
= Description
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
1
|
+
= Description
|
2
|
+
This library provides an Open3.popen3 implementation for MS Windows for
|
3
|
+
the Ruby 1.8.x branch.
|
4
|
+
|
5
|
+
= Prerequisites
|
6
|
+
Ruby 1.8.x branch only
|
7
|
+
C++ compiler (if building from source)
|
8
|
+
|
9
|
+
= Installation
|
10
|
+
gem install win32-open3 # Build and install from source
|
11
|
+
gem install win32-open3 --platform x86-mingw32 # Install the binary gem
|
12
|
+
|
13
|
+
= Synopsis
|
14
|
+
require 'win32/open3'
|
15
|
+
|
16
|
+
Open3.popen3('ver'){ |io_in, io_out, io_err|
|
17
|
+
error = io_err.gets
|
18
|
+
|
19
|
+
if error
|
20
|
+
puts "Error: " + error.chomp
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "Result: " + io_out.readlines.last.chomp
|
25
|
+
}
|
26
|
+
|
27
|
+
= Notes
|
28
|
+
This library is not supported on Windows 95, 98, or ME.
|
29
|
+
This is a stripped down version of Park Heesob's win32_popen library.
|
30
|
+
|
31
|
+
= Developer's Notes
|
32
|
+
This is a repackaging of Heesob's win32_popen module. The purpose of the
|
33
|
+
repackaging was to create a unified API between the existing Ruby open3
|
34
|
+
library and this library.
|
35
|
+
|
36
|
+
The popen2 and posix_popen methods are not included in this release. They
|
37
|
+
were originally part of the win32_popen module, but have been left out.
|
38
|
+
They may be added back in at a later date.
|
39
|
+
|
40
|
+
There are a couple of differences in the Windows version for open3 (which
|
41
|
+
also apply to Open4.popen4) - the mode flag and the show flag. For the
|
42
|
+
mode, you can specify either 't' (text, the default) or 'b' (binary) as a
|
43
|
+
second argument. For the show flag, you can specify either true or false,
|
44
|
+
which will show the console window, or not, depending on the value you
|
45
|
+
pass. The default is false.
|
46
|
+
|
47
|
+
= Known Issues
|
48
|
+
I have noticed that this library (and others) may segfault if you are using
|
49
|
+
the latest version of the Ruby one-click installer and VC++ 7.0 or later.
|
50
|
+
This appears to be an issue between VC++ 6 (which the installer was built
|
51
|
+
with) and VC++ 7.0. Your best solution is to either upgrade your C
|
52
|
+
compiler or to rebuild Ruby from scratch rather than using the installer.
|
53
|
+
|
54
|
+
= Precompiled binaries
|
55
|
+
If you do a typical "gem install win32-open3" you will get a precompiled
|
56
|
+
binary appropriate for your platform. If you want to build from source,
|
57
|
+
go the project page and download, download the .zip file, and run the
|
58
|
+
'install' Rake task from the command line.
|
59
|
+
|
60
|
+
= Future Plans
|
61
|
+
Replace the current implementation with a pure Ruby version, if possible.
|
62
|
+
|
63
|
+
= More Documentation
|
64
|
+
See the doc/open3.txt file for more details.
|
data/Rakefile
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rbconfig'
|
5
|
+
include Config
|
6
|
+
|
7
|
+
make = CONFIG['MAKEFILES'].nil? ? 'nmake' : 'make'
|
8
|
+
|
9
|
+
desc 'Install the win32-open3 library'
|
10
|
+
task :install => [:build] do
|
11
|
+
Dir.chdir('ext'){
|
12
|
+
sh "#{make} install"
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Clean any build files for win32-open3"
|
17
|
+
task :clean do
|
18
|
+
Dir.chdir('ext') do
|
19
|
+
if File.exists?('open3.so') || File.exists?('win32/open3.so')
|
20
|
+
sh "#{make} distclean"
|
21
|
+
rm 'win32/open3.so' if File.exists?('win32/open3.so')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
rm_rf 'lib'
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Build win32-open3 (but don't install it)"
|
28
|
+
task :build => [:clean] do
|
29
|
+
Dir.chdir('ext') do
|
30
|
+
ruby 'extconf.rb'
|
31
|
+
sh make
|
32
|
+
mv 'open3.so', 'win32' # For the test suite
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Run the sample program"
|
37
|
+
task :example => [:build] do |t|
|
38
|
+
Dir.chdir('examples'){
|
39
|
+
sh 'ruby -I../ext open3_test.rb'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
namespace 'gem' do
|
44
|
+
desc 'Clean any build files and remove the .gem file'
|
45
|
+
task :clean do
|
46
|
+
Dir["*.gem"].each{ |f| File.delete(f) }
|
47
|
+
Dir.chdir('ext') do
|
48
|
+
if File.exists?('open3.so') || File.exists?('win32/open3.so')
|
49
|
+
sh "#{make} distclean"
|
50
|
+
rm 'win32/open3.so' if File.exists?('win32/open3.so')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'Build the gem'
|
56
|
+
task :build => [:clean] do
|
57
|
+
spec = eval(IO.read('win32-open3.gemspec'))
|
58
|
+
Gem::Builder.new(spec).build
|
59
|
+
end
|
60
|
+
|
61
|
+
desc 'Install the win32-open3 library as a gem'
|
62
|
+
task :install => [:build] do
|
63
|
+
file = Dir["*.gem"].first
|
64
|
+
sh "gem install #{file}"
|
65
|
+
end
|
66
|
+
|
67
|
+
desc 'Build a binary gem'
|
68
|
+
task :binary => [:clean] do
|
69
|
+
Dir.chdir('ext') do
|
70
|
+
ruby 'extconf.rb'
|
71
|
+
sh make
|
72
|
+
end
|
73
|
+
|
74
|
+
mkdir_p 'lib/win32'
|
75
|
+
mv 'ext/open3.so', 'lib/win32'
|
76
|
+
|
77
|
+
spec = eval(IO.read('win32-open3.gemspec'))
|
78
|
+
spec.extensions = nil
|
79
|
+
spec.platform = Gem::Platform::CURRENT
|
80
|
+
|
81
|
+
spec.files = Dir['**/*'].reject{ |file|
|
82
|
+
file.include?('ext') || file.include?('git')
|
83
|
+
}
|
84
|
+
|
85
|
+
Gem::Builder.new(spec).build
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Rake::TestTask.new('test') do |test|
|
90
|
+
task :test => [:build]
|
91
|
+
test.libs << 'ext'
|
92
|
+
test.warning = true
|
93
|
+
test.verbose = true
|
94
|
+
end
|
95
|
+
|
96
|
+
task :test do
|
97
|
+
Rake.application[:clean].execute
|
98
|
+
end
|
data/doc/open3.txt
CHANGED
@@ -1,79 +1,79 @@
|
|
1
|
-
= Description
|
2
|
-
|
3
|
-
|
4
|
-
= Synopsis
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
= Module functions
|
17
|
-
Open3.popen3(command, mode='t', show=false)
|
18
|
-
|
19
|
-
Open3.popen3(command, mode='t', show=false){ |io_in, io_out, io_err| ... }
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
Open4.popen4(command, mode='t', show=false)
|
32
|
-
|
33
|
-
Open4.popen4(command, mode='t', show=false){ |io_in, io_out, io_err, pid| ... }
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
= Notes
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
= Acknowledgements
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
= Known Bugs
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
= License
|
67
|
-
|
68
|
-
|
69
|
-
= Copyright
|
70
|
-
|
71
|
-
|
72
|
-
= Warranty
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
= Authors
|
78
|
-
|
79
|
-
|
1
|
+
= Description
|
2
|
+
An open3 library for MS Windows for the Ruby 1.8.x branch.
|
3
|
+
|
4
|
+
= Synopsis
|
5
|
+
require 'win32/open3'
|
6
|
+
|
7
|
+
Open3.popen3('ver'){ |io_in, io_out, io_err|
|
8
|
+
error = io_err.gets
|
9
|
+
if error
|
10
|
+
puts "Error: " + error.chomp
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
puts "Result: " + io_out.readlines.last.chomp
|
14
|
+
}
|
15
|
+
|
16
|
+
= Module functions
|
17
|
+
Open3.popen3(command, mode='t', show=false)
|
18
|
+
|
19
|
+
Open3.popen3(command, mode='t', show=false){ |io_in, io_out, io_err| ... }
|
20
|
+
|
21
|
+
Executes 'command', returning an array of three IO handles representing
|
22
|
+
STDIN, STDOUT and STDERR, respectively. In block form these IO handles
|
23
|
+
are yielded back to the block and automatically closed at the end of the
|
24
|
+
block.
|
25
|
+
|
26
|
+
You may optionally pass a mode flag of 't' (text, the default) or 'b'
|
27
|
+
(binary) to this method.
|
28
|
+
|
29
|
+
If the 'show' variable is set to true, then a console window is shown.
|
30
|
+
|
31
|
+
Open4.popen4(command, mode='t', show=false)
|
32
|
+
|
33
|
+
Open4.popen4(command, mode='t', show=false){ |io_in, io_out, io_err, pid| ... }
|
34
|
+
|
35
|
+
Executes 'command', returning an array consisting of three IO handles,
|
36
|
+
representing STDIN, STDOUT and STDERR, respectively, as well as the PID
|
37
|
+
of the newly generated process. In block form these IO handles and pid
|
38
|
+
are yielded back to the block and automatically closed at the end of the
|
39
|
+
block.
|
40
|
+
|
41
|
+
You may optionally pass a mode flag of 't' (text, the default) or 'b'
|
42
|
+
(binary) to this method.
|
43
|
+
|
44
|
+
If the 'show' variable is set to true, then a console window is shown.
|
45
|
+
|
46
|
+
= Notes
|
47
|
+
This is a remake of Park Heesob's win32_popen package. It has been reworked
|
48
|
+
in order to make the API (nearly) identical to the Open3 package currently
|
49
|
+
included in the Ruby standard library.
|
50
|
+
|
51
|
+
For now only the popen3 and popen4 methods have been included. In later
|
52
|
+
releases we will probably add the popen2 and posix_popen methods back in.
|
53
|
+
|
54
|
+
Ruby 1.9.x users will not generally need this library because of its support
|
55
|
+
for native threads. That means you can use the open3 library that ships as
|
56
|
+
part of the standard library.
|
57
|
+
|
58
|
+
= Acknowledgements
|
59
|
+
Thanks go to Samuel Tesla and John-Mason Shackelford for their patches that
|
60
|
+
enabled us to set Process::Status.
|
61
|
+
|
62
|
+
= Known Bugs
|
63
|
+
None that I know of. Please log any other bug reports on the RubyForge
|
64
|
+
project page at http://www.rubyforge.net/projects/win32utils.
|
65
|
+
|
66
|
+
= License
|
67
|
+
Artistic 2.0
|
68
|
+
|
69
|
+
= Copyright
|
70
|
+
(C) 2003-2010 Daniel J. Berger, All Rights Reserved .
|
71
|
+
|
72
|
+
= Warranty
|
73
|
+
This package is provided "as is" and without any express or
|
74
|
+
implied warranties, including, without limitation, the implied
|
75
|
+
warranties of merchantability and fitness for a particular purpose.
|
76
|
+
|
77
|
+
= Authors
|
78
|
+
Park Heesob
|
79
|
+
Daniel J. Berger
|