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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f15d02987e0f6fb61ee1de1d2a7a58463ed533e
4
- data.tar.gz: 00bae3b277c92838151774688d3d69c691dc74f2
3
+ metadata.gz: e46688d94bfe27c279b73eb02843fab1e7a83db2
4
+ data.tar.gz: d72ef6c90fbeef9c71dc23f67686ba4f3793aba0
5
5
  SHA512:
6
- metadata.gz: dccbf2db7db79bb2dcaed2726ddb1b71e9c6620bc80dd22bf4b45c6c1d9142e56731961294df701296972efada62bed9db15a12bf2af0b35073f4469fef80b47
7
- data.tar.gz: ba1b3c25f5a7141b5632960054d9617af5fbf40b360dba30d0c73a34aac7f0f42cfdfe909066cc7e4408a18c6340901aaa433a5b3d729e469d465e3e6162fd23
6
+ metadata.gz: 8ba10a259c2cb39a937cdbb4175e6e886e958470c66970f2cf6f8e930dbae425fe46ef57a1efa0e9042dafa5c400ced65e0915352674e37d6ae6f2a0913a0d47
7
+ data.tar.gz: 019d24fea23a564dc961aefac8af5d0fcd168fc145965dd3fee4059a762f4c1a43fadcf6f35eabee3ca86a9b2dd103bc74bac4b297680a36626cbf260996a9d3
@@ -1,3 +1,3 @@
1
1
  module ChildProcess
2
- VERSION = "0.4.1.rc1"
2
+ VERSION = "0.4.1.rc2"
3
3
  end
@@ -17,6 +17,7 @@ module ChildProcess
17
17
  CTRL_C_EVENT = 0
18
18
  CTRL_BREAK_EVENT = 1
19
19
 
20
+ CREATE_BREAKAWAY_FROM_JOB = 0x01000000
20
21
  DETACHED_PROCESS = 0x00000008
21
22
 
22
23
  STARTF_USESTDHANDLES = 0x00000100
@@ -28,7 +28,7 @@ module ChildProcess
28
28
  create_environment_pointer
29
29
  create_cwd_pointer
30
30
 
31
- setup_detach
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 setup_detach
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
@@ -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 = within(5) do
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
- within(3) { alive?(pid).should be_false }
215
+ wait_until(3) { alive?(pid).should be_false }
216
216
  end
217
217
  end
218
218
  end
@@ -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 = Time.now + timeout
166
+ end_time = Time.now + timeout
184
167
  last_exception = nil
185
168
 
186
169
  until Time.now >= end_time
187
170
  begin
188
- return if yield
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.rc1
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-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec