kommando 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/examples/thread_leak.rb +10 -0
- data/lib/kommando.rb +15 -8
- data/lib/kommando/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 114c6d5e9933de3694419b769250a48d36f92c70
|
4
|
+
data.tar.gz: 50f77767dd71d6b195d72af7d3e4d2bd727a2e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4529a5e5c95b7fca83e13a2c1fe77dd5b5a0f5842171af8b0c3c1f1b15acfacc9dbe3e11406622b1e025e3143a5d407fc3e74ceb0bd4ca39f6edcdece7a06474
|
7
|
+
data.tar.gz: 362e3369d281e2ccfb222abcf51a781d057bbe5981a55601b00ee1287786957d3215b9c7b396e2d51f1e2f21835adc498ffdefcede597373754b61cb4269371f
|
data/CHANGELOG.md
CHANGED
data/lib/kommando.rb
CHANGED
@@ -52,6 +52,7 @@ class Kommando
|
|
52
52
|
|
53
53
|
@code = nil
|
54
54
|
@executed = false
|
55
|
+
@process_completed = false
|
55
56
|
|
56
57
|
if opts[:retry]
|
57
58
|
if opts[:retry][:times]
|
@@ -155,7 +156,12 @@ class Kommando
|
|
155
156
|
thread_stdin = Thread.new do
|
156
157
|
sleep 0.1 # allow program to start, do not write "in terminal"
|
157
158
|
while true do
|
159
|
+
break if @process_completed
|
160
|
+
# c = nil
|
161
|
+
# Timeout.timeout(1) do
|
158
162
|
c = @stdin.getc
|
163
|
+
#end
|
164
|
+
|
159
165
|
unless c
|
160
166
|
sleep 0.01
|
161
167
|
next
|
@@ -170,15 +176,16 @@ class Kommando
|
|
170
176
|
if @timeout
|
171
177
|
begin
|
172
178
|
Timeout.timeout(@timeout) do
|
173
|
-
process_stdout(stdout, stdout_file)
|
179
|
+
process_stdout(pid, stdout, stdout_file)
|
174
180
|
end
|
175
181
|
rescue Timeout::Error
|
176
182
|
Process.kill('KILL', pid)
|
177
183
|
@timeout_happened = true
|
178
184
|
end
|
179
185
|
else
|
180
|
-
process_stdout(stdout, stdout_file)
|
186
|
+
process_stdout(pid, stdout, stdout_file)
|
181
187
|
end
|
188
|
+
@process_completed = true
|
182
189
|
|
183
190
|
stdout_file.close if @output_file
|
184
191
|
end
|
@@ -279,17 +286,17 @@ class Kommando
|
|
279
286
|
PTY
|
280
287
|
end
|
281
288
|
|
282
|
-
def process_stdout(stdout, stdout_file)
|
289
|
+
def process_stdout(pid, stdout, stdout_file)
|
290
|
+
flushing = false
|
283
291
|
while true do
|
284
292
|
begin
|
285
|
-
|
286
|
-
rescue Errno::
|
287
|
-
|
288
|
-
break
|
293
|
+
Process.getpgid(pid)
|
294
|
+
rescue Errno::ESRCH => ex
|
295
|
+
flushing = true
|
289
296
|
end
|
290
297
|
|
291
298
|
c = stdout.getc
|
292
|
-
|
299
|
+
break if flushing == true && c == nil
|
293
300
|
next unless c
|
294
301
|
|
295
302
|
@stdout.append c if c
|
data/lib/kommando/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kommando
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matti Paksula
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- examples/shorthands.rb
|
133
133
|
- examples/stderr_to_out.rb
|
134
134
|
- examples/stdout_to_file.rb
|
135
|
+
- examples/thread_leak.rb
|
135
136
|
- examples/timeout.rb
|
136
137
|
- examples/uptime.rb
|
137
138
|
- examples/wait.rb
|