open3_backport 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -197,8 +197,9 @@ The following examples do not work yet. Pull requests are welcome!
197
197
 
198
198
  ## Version History
199
199
 
200
+ 0.0.3 - Bugfix: Critical performance enhancement.
201
+
200
202
  0.0.2 - Bugfix: Include open3 explicitly before redefining.
201
- Thanks david-mccullars!
202
203
 
203
204
  0.0.1 - Initial release. No support for setting environment nor
204
205
  passing any of the special options that Process.spawn supports in Ruby 1.9.
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # = open3.rb: Popen, but with stderr, too
3
3
  #
4
- # Author:: Yukihiro Matsumoto, backport by Chris Johnson
5
- # Documentation:: Konrad Meyer, backport by Chris Johnson
4
+ # Author:: Yukihiro Matsumoto, backport by Chris Johnson & David McCullars
5
+ # Documentation:: Konrad Meyer, backport by Chris Johnson & David McCullars
6
6
  #
7
7
  # Open3 gives you access to stdin, stdout, and stderr when running other
8
8
  # programs.
@@ -30,8 +30,22 @@ module Open3
30
30
  def detach(pid) # :nodoc:
31
31
  thread = Process.detach(pid)
32
32
  thread[:pid] = pid
33
- def thread.pid
34
- self[:pid]
33
+ thread.instance_eval do
34
+
35
+ def pid
36
+ self[:pid]
37
+ end
38
+
39
+ def value(*args)
40
+ self[:value] ||= begin
41
+ Process.waitpid(pid) rescue nil
42
+ $?
43
+ ensure
44
+ self.run
45
+ self.join
46
+ end
47
+ end
48
+
35
49
  end
36
50
  thread
37
51
  end
@@ -1,3 +1,3 @@
1
1
  module Open3Backport
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open3_backport
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
4
+ version: 0.0.3
11
5
  platform: ruby
12
6
  authors:
13
7
  - Chris Johnson
@@ -15,118 +9,69 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2013-01-18 00:00:00 Z
12
+ date: 2013-05-11 00:00:00 -05:00
13
+ default_executable:
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
16
+ name: open4
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
23
20
  requirements:
24
21
  - - ~>
25
22
  - !ruby/object:Gem::Version
26
- hash: 27
27
- segments:
28
- - 1
29
- - 3
30
- - 0
31
23
  version: 1.3.0
32
- prerelease: false
33
- type: :runtime
34
- name: open4
35
- requirement: *id001
24
+ version:
36
25
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
26
+ name: rake
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
39
30
  requirements:
40
31
  - - ">="
41
32
  - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
33
  version: "0"
46
- prerelease: false
47
- type: :development
48
- name: rake
49
- requirement: *id002
34
+ version:
50
35
  - !ruby/object:Gem::Dependency
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
- none: false
36
+ name: rspec
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
53
40
  requirements:
54
41
  - - ~>
55
42
  - !ruby/object:Gem::Version
56
- hash: 35
57
- segments:
58
- - 2
59
- - 11
60
- - 0
61
43
  version: 2.11.0
62
- prerelease: false
63
- type: :development
64
- name: rspec
65
- requirement: *id003
44
+ version:
66
45
  - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 63
73
- segments:
74
- - 0
75
- - 9
76
- - 2
77
- version: 0.9.2
78
- prerelease: false
46
+ name: guard
79
47
  type: :development
80
- name: rb-fsevent
81
- requirement: *id004
82
- - !ruby/object:Gem::Dependency
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
84
- none: false
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
85
50
  requirements:
86
51
  - - ~>
87
52
  - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 1
91
- - 5
92
- - 0
93
53
  version: 1.5.0
94
- prerelease: false
95
- type: :development
96
- name: guard
97
- requirement: *id005
54
+ version:
98
55
  - !ruby/object:Gem::Dependency
99
- version_requirements: &id006 !ruby/object:Gem::Requirement
100
- none: false
56
+ name: guard-bundler
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
101
60
  requirements:
102
61
  - - ~>
103
62
  - !ruby/object:Gem::Version
104
- hash: 23
105
- segments:
106
- - 1
107
- - 0
108
- - 0
109
63
  version: 1.0.0
110
- prerelease: false
111
- type: :development
112
- name: guard-bundler
113
- requirement: *id006
64
+ version:
114
65
  - !ruby/object:Gem::Dependency
115
- version_requirements: &id007 !ruby/object:Gem::Requirement
116
- none: false
66
+ name: guard-rspec
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
117
70
  requirements:
118
71
  - - ~>
119
72
  - !ruby/object:Gem::Version
120
- hash: 11
121
- segments:
122
- - 2
123
- - 1
124
- - 0
125
73
  version: 2.1.0
126
- prerelease: false
127
- type: :development
128
- name: guard-rspec
129
- requirement: *id007
74
+ version:
130
75
  description: Backport of new Open3 methods from Ruby 1.9 to Ruby 1.8
131
76
  email:
132
77
  - chris@kindkid.com
@@ -156,6 +101,7 @@ files:
156
101
  - tasks/console.rake
157
102
  - tasks/environment.rake
158
103
  - tasks/spec.rake
104
+ has_rdoc: true
159
105
  homepage: https://github.com/kindkid/open3_backport
160
106
  licenses: []
161
107
 
@@ -165,27 +111,21 @@ rdoc_options: []
165
111
  require_paths:
166
112
  - lib
167
113
  required_ruby_version: !ruby/object:Gem::Requirement
168
- none: false
169
114
  requirements:
170
115
  - - ">="
171
116
  - !ruby/object:Gem::Version
172
- hash: 3
173
- segments:
174
- - 0
175
117
  version: "0"
118
+ version:
176
119
  required_rubygems_version: !ruby/object:Gem::Requirement
177
- none: false
178
120
  requirements:
179
121
  - - ">="
180
122
  - !ruby/object:Gem::Version
181
- hash: 3
182
- segments:
183
- - 0
184
123
  version: "0"
124
+ version:
185
125
  requirements: []
186
126
 
187
127
  rubyforge_project:
188
- rubygems_version: 1.8.24
128
+ rubygems_version: 1.3.5
189
129
  signing_key:
190
130
  specification_version: 3
191
131
  summary: Backport of new Open3 methods from Ruby 1.9 to Ruby 1.8