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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/threaded_runner.rb +11 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fd48996c0b12b1baabfc4dc59eef840357cdd74
4
- data.tar.gz: 4f5f54e75b6038c1ff26eadc560c68a88690f9fc
3
+ metadata.gz: ae5ddcb21bb5b59293bbe3a5180f393ff9930a11
4
+ data.tar.gz: f08b3ebe5c7e306b4f8d747708fbe4cdfd6db2f9
5
5
  SHA512:
6
- metadata.gz: d657db304a24771962510eb0cda3e3a987b248d86a7db6aac917c454a310935f4fc09d4b959d83257de0dff6ff928385753be3bbbb8b3fe4773bc55cae44e6b5
7
- data.tar.gz: bd656b22e7a602033ea344309274199463067554fcbbf6e58f9906764aea5d93803642b1a465104d7a0b554117f8420d00584acf0f6ada2da40411bc954f5425
6
+ metadata.gz: 1827b34d079976e45eadc4da30a94e2c0989ea6921381efc14e72134508402ce93dd8591cc5d50a1c926e573ab155f86c7be6ec5315cebab8d28882c1d93dfee
7
+ data.tar.gz: 053cbab02e19940d3d2d24e348ca55f66d6017901c603f26e872ace474b4e42bd55338ea7f0a30d44a176f45fe559a1696f45abf9a9f3d31a251da2361e06fe7
@@ -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) do
12
- IO.popen(@cmd) do |f|
13
- @pid = f.pid
14
- f.each_line do |line|
15
- line.strip!
16
- yield line if block_given?
17
- if @regex && line =~ @regex
18
- @gotit = true
19
- @regex = nil
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: threaded_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fairbairn