threaded_runner 1.0.0 → 1.0.1

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 +12 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5acfd9fec8fcca6aaf8b75462f7d141028d31c1e
4
- data.tar.gz: 47ed3909f322800ac4573d3093deb06ee8c1f88e
3
+ metadata.gz: 2fd48996c0b12b1baabfc4dc59eef840357cdd74
4
+ data.tar.gz: 4f5f54e75b6038c1ff26eadc560c68a88690f9fc
5
5
  SHA512:
6
- metadata.gz: c306932afe243916f3b0d530e91c709cdaf594c292edf252b000f053ee4c5ef7a8b8209d6ab9cf51d57dfc83f8197b72cc4e3de8b020e4fb71170c3b77544071
7
- data.tar.gz: ef7ba20e72b15208e16df89e606a6577ea1a865a14031dc8835c0f9467be64cc1524b5dad4f8aa768c8844a7b54e0d35b979d8120d03e6d1b31df1500a151a11
6
+ metadata.gz: d657db304a24771962510eb0cda3e3a987b248d86a7db6aac917c454a310935f4fc09d4b959d83257de0dff6ff928385753be3bbbb8b3fe4773bc55cae44e6b5
7
+ data.tar.gz: bd656b22e7a602033ea344309274199463067554fcbbf6e58f9906764aea5d93803642b1a465104d7a0b554117f8420d00584acf0f6ada2da40411bc954f5425
@@ -1,20 +1,23 @@
1
1
  class ThreadedRunner
2
- def initialize(cmd)
2
+ def initialize(cmd, wdir='.')
3
3
  @cmd = cmd
4
+ @wdir = wdir
4
5
  end
5
6
 
6
7
  attr_reader :thread
7
8
 
8
9
  def start(wait_for=nil)
9
10
  @thread = Thread.new do
10
- IO.popen(@cmd) do |f|
11
- @pid = f.pid
12
- f.each_line do |line|
13
- line.strip!
14
- yield line if block_given?
15
- if @regex && line =~ @regex
16
- @gotit = true
17
- @regex = nil
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
18
21
  end
19
22
  end
20
23
  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.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fairbairn