childprocess 0.4.1.rc1 → 0.4.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/childprocess/version.rb +1 -1
- data/lib/childprocess/windows/lib.rb +1 -0
- data/lib/childprocess/windows/process_builder.rb +3 -2
- data/spec/childprocess_spec.rb +3 -3
- data/spec/spec_helper.rb +4 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e46688d94bfe27c279b73eb02843fab1e7a83db2
|
4
|
+
data.tar.gz: d72ef6c90fbeef9c71dc23f67686ba4f3793aba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba10a259c2cb39a937cdbb4175e6e886e958470c66970f2cf6f8e930dbae425fe46ef57a1efa0e9042dafa5c400ced65e0915352674e37d6ae6f2a0913a0d47
|
7
|
+
data.tar.gz: 019d24fea23a564dc961aefac8af5d0fcd168fc145965dd3fee4059a762f4c1a43fadcf6f35eabee3ca86a9b2dd103bc74bac4b297680a36626cbf260996a9d3
|
data/lib/childprocess/version.rb
CHANGED
@@ -28,7 +28,7 @@ module ChildProcess
|
|
28
28
|
create_environment_pointer
|
29
29
|
create_cwd_pointer
|
30
30
|
|
31
|
-
|
31
|
+
setup_flags
|
32
32
|
setup_io
|
33
33
|
|
34
34
|
pid = create_process
|
@@ -97,8 +97,9 @@ module ChildProcess
|
|
97
97
|
@process_info ||= ProcessInfo.new
|
98
98
|
end
|
99
99
|
|
100
|
-
def
|
100
|
+
def setup_flags
|
101
101
|
@flags |= DETACHED_PROCESS if @detach
|
102
|
+
@flags |= CREATE_BREAKAWAY_FROM_JOB
|
102
103
|
end
|
103
104
|
|
104
105
|
def setup_io
|
data/spec/childprocess_spec.rb
CHANGED
@@ -203,16 +203,16 @@ describe ChildProcess do
|
|
203
203
|
}
|
204
204
|
end
|
205
205
|
|
206
|
-
it 'kills the full process tree' do
|
206
|
+
it 'kills the full process tree', :process_builder => false do
|
207
207
|
Tempfile.open('kill-process-tree') do |file|
|
208
208
|
process = write_pid_in_sleepy_grand_child(file.path).start
|
209
209
|
|
210
|
-
pid =
|
210
|
+
pid = wait_until(30) do
|
211
211
|
Integer(rewind_and_read(file)) rescue nil
|
212
212
|
end
|
213
213
|
|
214
214
|
process.stop
|
215
|
-
|
215
|
+
wait_until(3) { alive?(pid).should be_false }
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -62,7 +62,7 @@ module ChildProcessSpecHelper
|
|
62
62
|
|
63
63
|
def write_pid_in_sleepy_grand_child(path)
|
64
64
|
code = <<-RUBY
|
65
|
-
system "ruby", "-e", 'File.open(#{path.inspect}, "w") { |f| f << Process.pid }; sleep'
|
65
|
+
system "ruby", "-e", 'File.open(#{path.inspect}, "w") { |f| f << Process.pid; f.flush }; sleep'
|
66
66
|
RUBY
|
67
67
|
|
68
68
|
ruby_process tmp_script(code)
|
@@ -92,23 +92,6 @@ module ChildProcessSpecHelper
|
|
92
92
|
@tf.path
|
93
93
|
end
|
94
94
|
|
95
|
-
def within(seconds, &blk)
|
96
|
-
end_time = Time.now + seconds
|
97
|
-
ok = false
|
98
|
-
last_error = nil
|
99
|
-
|
100
|
-
until ok || Time.now >= end_time
|
101
|
-
begin
|
102
|
-
ok = yield
|
103
|
-
rescue RSpec::Expectations::ExpectationNotMetError => last_error
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
raise last_error unless ok
|
108
|
-
|
109
|
-
ok
|
110
|
-
end
|
111
|
-
|
112
95
|
def cat
|
113
96
|
if ChildProcess.os == :windows
|
114
97
|
ruby(<<-CODE)
|
@@ -180,12 +163,13 @@ module ChildProcessSpecHelper
|
|
180
163
|
end
|
181
164
|
|
182
165
|
def wait_until(timeout = 10, &blk)
|
183
|
-
end_time
|
166
|
+
end_time = Time.now + timeout
|
184
167
|
last_exception = nil
|
185
168
|
|
186
169
|
until Time.now >= end_time
|
187
170
|
begin
|
188
|
-
|
171
|
+
result = yield
|
172
|
+
return result if result
|
189
173
|
rescue RSpec::Expectations::ExpectationNotMetError => ex
|
190
174
|
last_exception = ex
|
191
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: childprocess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.1.
|
4
|
+
version: 0.4.1.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|