win32-open3 0.3.1-x86-mswin32-60 → 0.3.2-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- 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/lib/win32/open3.so
CHANGED
Binary file
|
data/test/test_win32_open3.rb
CHANGED
@@ -1,113 +1,113 @@
|
|
1
|
-
###########################################################################
|
2
|
-
# test_win32_open3.rb
|
3
|
-
#
|
4
|
-
# Test suite for the win32-open3 library. Except for the
|
5
|
-
# 'test_open3_with_arguments' test and Open4 tests, this suite passes
|
6
|
-
# on Unix as well.
|
7
|
-
#
|
8
|
-
# You should run this test suite via the 'rake test' task.
|
9
|
-
###########################################################################
|
10
|
-
require 'win32/open3'
|
11
|
-
require 'test/unit'
|
12
|
-
|
13
|
-
class TC_Win32_Open3 < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
@good_cmd = 'ver'
|
16
|
-
@bad_cmd = 'verb'
|
17
|
-
@stdin = nil
|
18
|
-
@stdout = nil
|
19
|
-
@stderr = nil
|
20
|
-
@value = nil
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_open3_version
|
24
|
-
assert_equal('0.3.1', Open3::WIN32_OPEN3_VERSION)
|
25
|
-
assert_equal('0.3.1', Open4::WIN32_OPEN3_VERSION)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_open3_basic
|
29
|
-
assert_respond_to(Open3, :popen3)
|
30
|
-
assert_nothing_raised{ Open3.popen3(@good_cmd) }
|
31
|
-
assert_nothing_raised{ Open3.popen3(@bad_cmd) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_open4_basic
|
35
|
-
assert_respond_to(Open4, :popen4)
|
36
|
-
assert_nothing_raised{ Open4.popen4(@good_cmd) }
|
37
|
-
assert_nothing_raised{ Open4.popen4(@bad_cmd) }
|
38
|
-
end
|
39
|
-
|
40
|
-
# This test would fail on other platforms
|
41
|
-
def test_open3_with_arguments
|
42
|
-
assert_nothing_raised{ Open3.popen3(@good_cmd, 't') }
|
43
|
-
assert_nothing_raised{ Open3.popen3(@bad_cmd, 't') }
|
44
|
-
assert_nothing_raised{ Open3.popen3(@good_cmd, 'b') }
|
45
|
-
assert_nothing_raised{ Open3.popen3(@bad_cmd, 'b') }
|
46
|
-
assert_nothing_raised{ Open3.popen3(@good_cmd, 't', false) }
|
47
|
-
assert_nothing_raised{ Open3.popen3(@good_cmd, 't', true) }
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_open3_handles
|
51
|
-
arr = Open3.popen3(@good_cmd)
|
52
|
-
assert_kind_of(Array, arr)
|
53
|
-
assert_kind_of(IO, arr[0])
|
54
|
-
assert_kind_of(IO, arr[1])
|
55
|
-
assert_kind_of(IO, arr[2])
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_open3_block
|
59
|
-
assert_nothing_raised{ Open3.popen3(@good_cmd){ |pin, pout, perr| } }
|
60
|
-
Open3.popen3(@good_cmd){ |pin, pout, perr|
|
61
|
-
assert_kind_of(IO, pin)
|
62
|
-
assert_kind_of(IO, pout)
|
63
|
-
assert_kind_of(IO, perr)
|
64
|
-
}
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_open4_block
|
68
|
-
assert_nothing_raised{ Open4.popen4(@good_cmd){ |pin, pout, perr, pid| } }
|
69
|
-
Open4.popen4(@good_cmd){ |pin, pout, perr, pid|
|
70
|
-
assert_kind_of(IO, pin)
|
71
|
-
assert_kind_of(IO, pout)
|
72
|
-
assert_kind_of(IO, perr)
|
73
|
-
assert_kind_of(Fixnum, pid)
|
74
|
-
}
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_open4_return_values
|
78
|
-
arr = Open4.popen4(@good_cmd)
|
79
|
-
assert_kind_of(Array,arr)
|
80
|
-
assert_kind_of(IO, arr[0])
|
81
|
-
assert_kind_of(IO, arr[1])
|
82
|
-
assert_kind_of(IO, arr[2])
|
83
|
-
assert_kind_of(Fixnum, arr[3])
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_handle_good_content
|
87
|
-
fin, fout, ferr = Open3.popen3(@good_cmd)
|
88
|
-
assert_kind_of(String, fout.gets)
|
89
|
-
assert_nil(ferr.gets)
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_handle_bad_content
|
93
|
-
fin, fout, ferr = Open3.popen3(@bad_cmd)
|
94
|
-
assert_kind_of(String, ferr.gets)
|
95
|
-
assert_nil(fout.gets)
|
96
|
-
end
|
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
|
-
|
108
|
-
def teardown
|
109
|
-
@good_cmd = nil
|
110
|
-
@bad_cmd = nil
|
111
|
-
@value = nil
|
112
|
-
end
|
113
|
-
end
|
1
|
+
###########################################################################
|
2
|
+
# test_win32_open3.rb
|
3
|
+
#
|
4
|
+
# Test suite for the win32-open3 library. Except for the
|
5
|
+
# 'test_open3_with_arguments' test and Open4 tests, this suite passes
|
6
|
+
# on Unix as well.
|
7
|
+
#
|
8
|
+
# You should run this test suite via the 'rake test' task.
|
9
|
+
###########################################################################
|
10
|
+
require 'win32/open3'
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
class TC_Win32_Open3 < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@good_cmd = 'ver'
|
16
|
+
@bad_cmd = 'verb'
|
17
|
+
@stdin = nil
|
18
|
+
@stdout = nil
|
19
|
+
@stderr = nil
|
20
|
+
@value = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_open3_version
|
24
|
+
assert_equal('0.3.1', Open3::WIN32_OPEN3_VERSION)
|
25
|
+
assert_equal('0.3.1', Open4::WIN32_OPEN3_VERSION)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_open3_basic
|
29
|
+
assert_respond_to(Open3, :popen3)
|
30
|
+
assert_nothing_raised{ Open3.popen3(@good_cmd) }
|
31
|
+
assert_nothing_raised{ Open3.popen3(@bad_cmd) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_open4_basic
|
35
|
+
assert_respond_to(Open4, :popen4)
|
36
|
+
assert_nothing_raised{ Open4.popen4(@good_cmd) }
|
37
|
+
assert_nothing_raised{ Open4.popen4(@bad_cmd) }
|
38
|
+
end
|
39
|
+
|
40
|
+
# This test would fail on other platforms
|
41
|
+
def test_open3_with_arguments
|
42
|
+
assert_nothing_raised{ Open3.popen3(@good_cmd, 't') }
|
43
|
+
assert_nothing_raised{ Open3.popen3(@bad_cmd, 't') }
|
44
|
+
assert_nothing_raised{ Open3.popen3(@good_cmd, 'b') }
|
45
|
+
assert_nothing_raised{ Open3.popen3(@bad_cmd, 'b') }
|
46
|
+
assert_nothing_raised{ Open3.popen3(@good_cmd, 't', false) }
|
47
|
+
assert_nothing_raised{ Open3.popen3(@good_cmd, 't', true) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_open3_handles
|
51
|
+
arr = Open3.popen3(@good_cmd)
|
52
|
+
assert_kind_of(Array, arr)
|
53
|
+
assert_kind_of(IO, arr[0])
|
54
|
+
assert_kind_of(IO, arr[1])
|
55
|
+
assert_kind_of(IO, arr[2])
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_open3_block
|
59
|
+
assert_nothing_raised{ Open3.popen3(@good_cmd){ |pin, pout, perr| } }
|
60
|
+
Open3.popen3(@good_cmd){ |pin, pout, perr|
|
61
|
+
assert_kind_of(IO, pin)
|
62
|
+
assert_kind_of(IO, pout)
|
63
|
+
assert_kind_of(IO, perr)
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_open4_block
|
68
|
+
assert_nothing_raised{ Open4.popen4(@good_cmd){ |pin, pout, perr, pid| } }
|
69
|
+
Open4.popen4(@good_cmd){ |pin, pout, perr, pid|
|
70
|
+
assert_kind_of(IO, pin)
|
71
|
+
assert_kind_of(IO, pout)
|
72
|
+
assert_kind_of(IO, perr)
|
73
|
+
assert_kind_of(Fixnum, pid)
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_open4_return_values
|
78
|
+
arr = Open4.popen4(@good_cmd)
|
79
|
+
assert_kind_of(Array,arr)
|
80
|
+
assert_kind_of(IO, arr[0])
|
81
|
+
assert_kind_of(IO, arr[1])
|
82
|
+
assert_kind_of(IO, arr[2])
|
83
|
+
assert_kind_of(Fixnum, arr[3])
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_handle_good_content
|
87
|
+
fin, fout, ferr = Open3.popen3(@good_cmd)
|
88
|
+
assert_kind_of(String, fout.gets)
|
89
|
+
assert_nil(ferr.gets)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_handle_bad_content
|
93
|
+
fin, fout, ferr = Open3.popen3(@bad_cmd)
|
94
|
+
assert_kind_of(String, ferr.gets)
|
95
|
+
assert_nil(fout.gets)
|
96
|
+
end
|
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
|
+
|
108
|
+
def teardown
|
109
|
+
@good_cmd = nil
|
110
|
+
@bad_cmd = nil
|
111
|
+
@value = nil
|
112
|
+
end
|
113
|
+
end
|
data/win32-open3.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'win32-open3'
|
5
|
+
spec.version = '0.3.2'
|
6
|
+
spec.authors = ['Park Heesob', 'Daniel J. Berger']
|
7
|
+
spec.email = 'djberg96@gmail.com'
|
8
|
+
spec.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.summary = 'Provides an Open3.popen3 implementation for MS Windows'
|
11
|
+
spec.test_file = 'test/test_win32_open3.rb'
|
12
|
+
spec.has_rdoc = true
|
13
|
+
spec.license = 'Artistic 2.0'
|
14
|
+
spec.extensions = ['ext/extconf.rb']
|
15
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
16
|
+
|
17
|
+
spec.extra_rdoc_files = [
|
18
|
+
'CHANGES',
|
19
|
+
'README',
|
20
|
+
'MANIFEST',
|
21
|
+
'doc/open3.txt',
|
22
|
+
'ext/win32/open3.c'
|
23
|
+
]
|
24
|
+
|
25
|
+
spec.rubyforge_project = 'win32utils'
|
26
|
+
spec.required_ruby_version = '< 1.9.0'
|
27
|
+
|
28
|
+
spec.description = <<-EOF
|
29
|
+
The win32-open3 library provides a working implementation of the open3
|
30
|
+
library for MS Windows. In addition, it provides the Open4 class, which
|
31
|
+
also returns pid information.
|
32
|
+
|
33
|
+
Note that this library is unnecessary with Ruby 1.9.x because of its
|
34
|
+
support for native threads.
|
35
|
+
EOF
|
36
|
+
end
|
metadata
CHANGED
@@ -1,38 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-open3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Park Heesob
|
8
|
-
- Daniel Berger
|
8
|
+
- Daniel J. Berger
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2010-03-22 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
17
|
-
description: "
|
17
|
+
description: " The win32-open3 library provides a working implementation 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 unnecessary with Ruby 1.9.x because of its\n support for native threads.\n"
|
18
18
|
email: djberg96@gmail.com
|
19
19
|
executables: []
|
20
20
|
|
21
21
|
extensions: []
|
22
22
|
|
23
23
|
extra_rdoc_files:
|
24
|
-
- README
|
25
24
|
- CHANGES
|
25
|
+
- README
|
26
26
|
- MANIFEST
|
27
27
|
- doc/open3.txt
|
28
28
|
- ext/win32/open3.c
|
29
29
|
files:
|
30
|
-
- lib/win32/open3.so
|
31
|
-
- test/test_win32_open3.rb
|
32
|
-
- README
|
33
30
|
- CHANGES
|
34
|
-
- MANIFEST
|
35
31
|
- doc/open3.txt
|
32
|
+
- examples/win32_open3_example.rb
|
33
|
+
- lib/win32/open3.so
|
34
|
+
- MANIFEST
|
35
|
+
- Rakefile
|
36
|
+
- README
|
37
|
+
- test/test_win32_open3.rb
|
38
|
+
- win32-open3.gemspec
|
36
39
|
- ext/win32/open3.c
|
37
40
|
has_rdoc: true
|
38
41
|
homepage: http://www.rubyforge.org/projects/win32utils
|
@@ -45,9 +48,9 @@ require_paths:
|
|
45
48
|
- lib
|
46
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
50
|
requirements:
|
48
|
-
- -
|
51
|
+
- - <
|
49
52
|
- !ruby/object:Gem::Version
|
50
|
-
version: 1.
|
53
|
+
version: 1.9.0
|
51
54
|
version:
|
52
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
56
|
requirements:
|
@@ -58,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
61
|
requirements: []
|
59
62
|
|
60
63
|
rubyforge_project: win32utils
|
61
|
-
rubygems_version: 1.3.
|
64
|
+
rubygems_version: 1.3.5
|
62
65
|
signing_key:
|
63
66
|
specification_version: 3
|
64
67
|
summary: Provides an Open3.popen3 implementation for MS Windows
|