win32-open3 0.2.9-x86-mswin32-60 → 0.3.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.3.0 - 22-Jun-2009
2
+ * Fixed an issue where the block form of the Open3.popen3 method did not
3
+ return the exit value.
4
+ * Fixed the version number.
5
+ * Added a test to validate the exit value in block form.
6
+ * Updated the gemspec description.
7
+
1
8
  == 0.2.9 - 8-Mar-2009
2
9
  * Fixed a bug within an internal function that could cause an exception.
3
10
  Thanks go to Ross Bunker for the spot and patch.
data/MANIFEST CHANGED
@@ -8,4 +8,4 @@
8
8
  * ext/extconf.rb
9
9
  * ext/win32/open3.c
10
10
  * ext/win32/open3.h
11
- * test/tc_open3.rb
11
+ * test/test_win32_open3.rb
data/doc/open3.txt ADDED
@@ -0,0 +1,75 @@
1
+ = Description
2
+ An open3 library for MS Windows.
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
+ = Acknowledgements
55
+ Thanks go to Samuel Tesla and John-Mason Shackelford for their patches that
56
+ enabled us to set Process::Status.
57
+
58
+ = Known Bugs
59
+ None that I know of. Please log any other bug reports on the RubyForge
60
+ project page at http://www.rubyforge.net/projects/win32utils.
61
+
62
+ = License
63
+ Ruby's
64
+
65
+ = Copyright
66
+ (C) 2003-2009 Daniel J. Berger, All Rights Reserved .
67
+
68
+ = Warranty
69
+ This package is provided "as is" and without any express or
70
+ implied warranties, including, without limitation, the implied
71
+ warranties of merchantability and fitness for a particular purpose.
72
+
73
+ = Authors
74
+ Park Heesob
75
+ Daniel J. Berger
data/ext/win32/open3.c CHANGED
@@ -136,8 +136,7 @@ static VALUE win32_popen3(int argc, VALUE *argv, VALUE klass)
136
136
 
137
137
  // Ensure handles are closed in block form
138
138
  if(rb_block_given_p()){
139
- rb_ensure(rb_yield_splat, v_port, io_close, v_port);
140
- return win32_last_status;
139
+ return rb_ensure(rb_yield_splat, v_port, io_close, v_port);
141
140
  }
142
141
 
143
142
  return v_port;
data/lib/win32/open3.so CHANGED
Binary file
@@ -17,11 +17,12 @@ class TC_Win32_Open3 < Test::Unit::TestCase
17
17
  @stdin = nil
18
18
  @stdout = nil
19
19
  @stderr = nil
20
+ @value = nil
20
21
  end
21
22
 
22
23
  def test_open3_version
23
- assert_equal('0.2.8', Open3::WIN32_OPEN3_VERSION)
24
- assert_equal('0.2.8', Open4::WIN32_OPEN3_VERSION)
24
+ assert_equal('0.3.0', Open3::WIN32_OPEN3_VERSION)
25
+ assert_equal('0.3.0', Open4::WIN32_OPEN3_VERSION)
25
26
  end
26
27
 
27
28
  def test_open3_basic
@@ -94,8 +95,19 @@ class TC_Win32_Open3 < Test::Unit::TestCase
94
95
  assert_nil(fout.gets)
95
96
  end
96
97
 
98
+ def test_exit_status_in_block_form_popen4
99
+ assert_nothing_raised{ @value = Open3.popen3('dir'){ |x,y,z| 1 } }
100
+ assert_equal(1, @value)
101
+ end
102
+
103
+ def test_exit_status_in_block_form_popen4
104
+ assert_nothing_raised{ @value = Open4.popen4('dir'){ |x,y,z,a| 1 } }
105
+ assert_equal(1, @value)
106
+ end
107
+
97
108
  def teardown
98
109
  @good_cmd = nil
99
110
  @bad_cmd = nil
111
+ @value = nil
100
112
  end
101
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-open3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Park Heesob
@@ -10,11 +10,11 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-03-07 23:00:00 -07:00
13
+ date: 2009-06-22 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
17
- description: Provides an Open3.popen3 implementation for MS Windows
17
+ description: " The win32-open3 library provides a working implemetation of the open3\n library for MS Windows. In addition, it provides the Open4 class, which\n also returns pid information.\n \n Note that this library is largely unnecessary with Ruby 1.9.x because of\n its support for native threads.\n"
18
18
  email: djberg96@gmail.com
19
19
  executables: []
20
20
 
@@ -24,6 +24,7 @@ extra_rdoc_files:
24
24
  - README
25
25
  - CHANGES
26
26
  - MANIFEST
27
+ - doc/open3.txt
27
28
  - ext/win32/open3.c
28
29
  files:
29
30
  - lib/win32/open3.so
@@ -31,9 +32,12 @@ files:
31
32
  - README
32
33
  - CHANGES
33
34
  - MANIFEST
35
+ - doc/open3.txt
34
36
  - ext/win32/open3.c
35
37
  has_rdoc: true
36
38
  homepage: http://www.rubyforge.org/projects/win32utils
39
+ licenses: []
40
+
37
41
  post_install_message:
38
42
  rdoc_options: []
39
43
 
@@ -54,9 +58,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
58
  requirements: []
55
59
 
56
60
  rubyforge_project: win32utils
57
- rubygems_version: 1.3.1
61
+ rubygems_version: 1.3.4
58
62
  signing_key:
59
- specification_version: 2
63
+ specification_version: 3
60
64
  summary: Provides an Open3.popen3 implementation for MS Windows
61
65
  test_files:
62
66
  - test/test_win32_open3.rb