threaded_runner 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/threaded_runner.rb +11 -10
- 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: ae5ddcb21bb5b59293bbe3a5180f393ff9930a11
|
4
|
+
data.tar.gz: f08b3ebe5c7e306b4f8d747708fbe4cdfd6db2f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1827b34d079976e45eadc4da30a94e2c0989ea6921381efc14e72134508402ce93dd8591cc5d50a1c926e573ab155f86c7be6ec5315cebab8d28882c1d93dfee
|
7
|
+
data.tar.gz: 053cbab02e19940d3d2d24e348ca55f66d6017901c603f26e872ace474b4e42bd55338ea7f0a30d44a176f45fe559a1696f45abf9a9f3d31a251da2361e06fe7
|
data/lib/threaded_runner.rb
CHANGED
@@ -7,21 +7,22 @@ class ThreadedRunner
|
|
7
7
|
attr_reader :thread
|
8
8
|
|
9
9
|
def start(wait_for=nil)
|
10
|
+
pwd = Dir.pwd
|
10
11
|
@thread = Thread.new do
|
11
|
-
Dir.chdir(@wdir)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
12
|
+
Dir.chdir(@wdir)
|
13
|
+
IO.popen(@cmd) do |f|
|
14
|
+
@pid = f.pid
|
15
|
+
f.each_line do |line|
|
16
|
+
line.strip!
|
17
|
+
yield line if block_given?
|
18
|
+
if @regex && line =~ @regex
|
19
|
+
@gotit = true
|
20
|
+
@regex = nil
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
+
Dir.chdir(pwd)
|
25
26
|
nil
|
26
27
|
wait_for(wait_for) if wait_for
|
27
28
|
end
|