shexecutor 0.0.13 → 0.0.14

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: d9b5ff685f5736caeee4b7da6f4ffdc89df35f6f
4
- data.tar.gz: 1adec7351ce61aab38684cd7eb42f61ca9f3c0a7
3
+ metadata.gz: b678ae7d3a2c936438a247ab6321e006993ca3d5
4
+ data.tar.gz: a3f122414398c3539f2736f571db00767c75f587
5
5
  SHA512:
6
- metadata.gz: 211b5d32097888858bf38f4dba7344cc7bc4b1cd08edd2c6d183d797ef6af7869a5685ecb0723e75b8f7fd19027afcd207e709ef585c4abcba282a85a064d06f
7
- data.tar.gz: 1021ef30c0a794c7f73ce021c8361057b843e3f53f44a14cff90900c7348f41776d3f877ed3779b4f6a4063916cf2a6ad44d529ddc6034849f148f11803db449
6
+ metadata.gz: 1c66a7fdda16715e38f22af6ad887e12b871c1ae764c2f58c7c30783001aa6467fca3d0c8372007088d05a0ca995da3619b7e6b84f4897363656d06b4e1005b6
7
+ data.tar.gz: 160022bdda265245738449777c2f63db01f4d25ad20b0dae7e9cef91ec04dd5065f67f72e2f7fa76db7975fefc5b1fdc78ba494ecdc81b3682a10954342c7ddd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shexecutor (0.0.12)
4
+ shexecutor (0.0.14)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module SHExecutor
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
data/lib/shexecutor.rb CHANGED
@@ -169,6 +169,8 @@ module SHExecutor
169
169
  IO.copy_stream(stderr, data_err)
170
170
  end
171
171
  end
172
+ m = Mutex.new
173
+ done = false
172
174
  # track timeout if required. Do this ourselves since the mechanism
173
175
  # is simple and Timeout struggles from multi-threading issues.
174
176
  # IO.copy_stream stop the Timeout exception from being thrown properly.
@@ -178,12 +180,29 @@ module SHExecutor
178
180
  sleep 0.1
179
181
  count = count + 1
180
182
  end
181
- raise Timeout::Error.new("execution expired") if @t0.alive?
183
+ m.synchronize do
184
+ done = true
185
+ raise Timeout::Error.new("execution expired") if @t0.alive?
186
+ end
182
187
  end if should_timeout?
183
188
  stdin.close
184
189
  t3.abort_on_exception = true if should_timeout?
185
190
  t1.join if not should_timeout?
186
191
  t2.join if not should_timeout?
192
+ if should_timeout?
193
+ m.synchronize do
194
+ d = done
195
+ end
196
+ while not d do
197
+ sleep 0.1
198
+ m.synchronize do
199
+ d = done
200
+ end
201
+ end
202
+ t1.join if not @t0.alive?
203
+ t2.join if not @t0.alive?
204
+ t3.join if not @t0.alive?
205
+ end
187
206
  end
188
207
  return data_out, data_err, @t0
189
208
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shexecutor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan