maestro_shell 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73beca833565d0135c019fb22c69b23ad6c3cbf0
4
- data.tar.gz: b33923670ef19d8189a09ec3742f273f17d08fe2
3
+ metadata.gz: 81ed4f0b65fb2d09a22195f1c5b27609b3cf35e8
4
+ data.tar.gz: 1808bd7d8e2de7ef9eced825e859dc7893134fa6
5
5
  SHA512:
6
- metadata.gz: b4d173a49cf9d44a615b7b170eda5b3e5873ff4ec31db8a0335193fec2d32c220699b85645e6398970fc03182a99ae2d4b968ee47d2bc3f266d9e8b8e5088332
7
- data.tar.gz: ccb83f5bc3ffe78f91546cbf5fa3c9843fd4213909eb1be830fec90b3f776720958d046beb2559e8955fdf88e00a99702cce8f2cfa1a24e97dd438f40296c909
6
+ metadata.gz: 06664c62196f45e188d85ad45f704e4b57022cf4b7b17784e865e5c24e371d1952f52562d2b8a8c9b9123e258ec0186e6f7b4aed271e4ee841ffdff6537072ef
7
+ data.tar.gz: b613cafeac99c90522d9b3da1a4d50c2930686f27270312ce22896656b7e5a813f63005ff0f058fdbdf3e0baa3f1927086aab9007ddb9ff4b8279ce0c88ec49a
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  Maestro Shell Utility Gem
2
2
  =========================
3
+ [![Gem Version](https://badge.fury.io/rb/maestro_shell.png)](http://badge.fury.io/rb/maestro_shell)
4
+ [![Code Climate](https://codeclimate.com/github/maestrodev/maestro-shell.png)](https://codeclimate.com/github/maestrodev/maestro-shell)
3
5
 
4
6
  Library For Executing Shell commands on Linux and Windows
5
7
  =========================================================
data/lib/util/shell.rb CHANGED
@@ -83,17 +83,36 @@ module Maestro
83
83
  process.start
84
84
  w.close
85
85
 
86
- while !r.eof? do
87
- text = r.readpartial(1024)
88
- out_file.write(text)
89
-
90
- if delegate && on_output
91
- delegate.send(on_output, text)
86
+ potential_eof = false
87
+ begin
88
+ loop {
89
+ text = r.read_nonblock(1024)
90
+ potential_eof = false
91
+ out_file.write(text)
92
+
93
+ if delegate && on_output
94
+ delegate.send(on_output, text)
95
+ end
96
+ }
97
+ rescue IO::WaitReadable => e
98
+ if !process.exited?
99
+ # process still running, block for input here to avoid a busy
100
+ # loop, but with a timeout in case the process exited with no
101
+ # further output
102
+ IO.select([r], nil, nil, 1)
103
+ retry
104
+ elsif !potential_eof
105
+ # process is done, but keep looping while there is input to
106
+ # read
107
+ potential_eof = true
108
+ retry
92
109
  end
110
+ rescue EOFError
111
+ # expected when we reach end of output from the process
93
112
  end
94
113
 
95
114
  r.close
96
- process.wait
115
+ process.wait unless process.exited?
97
116
  @exit_code = ExitCode.new(process.exit_code)
98
117
  end
99
118
 
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.8'
4
+ VERSION = '0.0.9'
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.8
4
+ version: 0.0.9
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-17 00:00:00.000000000 Z
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging