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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/shexecutor/version.rb +1 -1
- data/lib/shexecutor.rb +20 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b678ae7d3a2c936438a247ab6321e006993ca3d5
|
4
|
+
data.tar.gz: a3f122414398c3539f2736f571db00767c75f587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c66a7fdda16715e38f22af6ad887e12b871c1ae764c2f58c7c30783001aa6467fca3d0c8372007088d05a0ca995da3619b7e6b84f4897363656d06b4e1005b6
|
7
|
+
data.tar.gz: 160022bdda265245738449777c2f63db01f4d25ad20b0dae7e9cef91ec04dd5065f67f72e2f7fa76db7975fefc5b1fdc78ba494ecdc81b3682a10954342c7ddd
|
data/Gemfile.lock
CHANGED
data/lib/shexecutor/version.rb
CHANGED
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
|
-
|
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
|