maestro_shell 0.0.3 → 0.0.4

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: 3f2ca3dac172b93dccfde42bf5bfcfeb042a267f
4
- data.tar.gz: 5bf446d9b239637b23041364e3ecd30401568abf
3
+ metadata.gz: 7202e558e1c7bc226196fa6580f929837523680a
4
+ data.tar.gz: 2c56889dba049af09e23c1ad5fd9c888d3658df8
5
5
  SHA512:
6
- metadata.gz: dcbe93166275dfac4926dd321a2fe9e9caa15be545be9e3aa61fa643d98495f4adc6527022a4afd9a41b805bd1df9910fcec14112e39a42fe196a4079a537e53
7
- data.tar.gz: afe2c5eb62a9b975d4bedc13acf07199e99a2630c0b3b5129eb996e27a0f2cdabbd3b4f48cc73ce634332c1d5b5940145495ded01fed52a7b4e3a613a48df610
6
+ metadata.gz: 1671da72da032d007631ba2e9761f5ad2914e6aae54c334ecce0b4694e7f54660fda8cdfb93130d0761bc4814292e63f884aca5705d5a706d7ef73e4cbb39f93
7
+ data.tar.gz: 6c820aadf68fd69a0e0c98862584226e0c4fa398686e5b08f68c445de08bd62f5b0bc5e4beec3e0bed78a697886873a8416840dbd007a1ffff6410e4fac2be18
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maestro_shell (0.0.3)
4
+ maestro_shell (0.0.4)
5
5
  json (>= 1.4.6)
6
6
  logging (= 1.8.0)
7
7
  rubyzip (= 0.9.8)
data/lib/util/shell.rb CHANGED
@@ -76,22 +76,26 @@ module Maestro
76
76
  def run_script_with_delegate(delegate, on_output)
77
77
  File.open(@output_file.path, 'a') do |out_file|
78
78
  status = IO.popen4(@command_line) do |pid, stdin, stdout, stderr|
79
- threads = []
80
- # Read stdout/stderr and push to output
81
- [ stdout, stderr ].each do |stream|
82
- threads << Thread.new do
83
- while !stream.eof? && text = stream.readpartial(1024)
79
+ # Keep reading input until all (stdin/stderr) streams report eof
80
+ readers = [stdout, stderr]
81
+ while readers.any?
82
+ ready = IO.select(readers, [], readers)
83
+ # no writers
84
+ # ready[1].each { ... }
85
+ ready[0].each do |fd|
86
+ if fd.eof?
87
+ readers.delete fd
88
+ else
89
+
90
+ text = fd.readpartial(1024)
84
91
  out_file.write(text)
85
92
 
86
93
  if delegate && on_output
87
- delegate.send(on_output, text, stream == stderr)
94
+ delegate.send(on_output, text, fd == stderr)
88
95
  end
89
96
  end
90
97
  end
91
98
  end
92
-
93
- # Wait for stream handler threads to exit
94
- threads.each { |t| t.join }
95
99
  end
96
100
  end
97
101
 
data/lib/util/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Maestro
2
2
  module Util
3
3
  class Shell
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestro_shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Henderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-11 00:00:00.000000000 Z
11
+ date: 2013-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging