execute 0.1.47 → 0.1.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cmd.rb +4 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc624c094f70bb09172061104c82f9eb5f55b2b1
|
4
|
+
data.tar.gz: 19033bbad9ef895c7811e160b43db5364843932f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0bc9754acfb8e057d81160ef94dbcd04fea93578d2ddadcaf095c808ca27f3f216d6aff9724747088979da31f79d861cdb8330ee3eec17a42340699004e5943
|
7
|
+
data.tar.gz: eaa8b84b6ce32f01498cc99e2cc5b6ec9135ad8fe10ce6bea38cd8f5b348cd96ffa64aec65fc71c65a2db1adadce0dd006da880a260c695df9268c7bf027b5ad
|
data/lib/cmd.rb
CHANGED
@@ -84,7 +84,7 @@ class CMD < Hash
|
|
84
84
|
sleep(0.1)
|
85
85
|
if((Time.now - start_time).to_f > self[:timeout])
|
86
86
|
self[:timed_out] = true
|
87
|
-
|
87
|
+
kill_child_processes
|
88
88
|
sleep(0.1)
|
89
89
|
end
|
90
90
|
end
|
@@ -93,7 +93,7 @@ class CMD < Hash
|
|
93
93
|
|
94
94
|
{:output => stdout,:error => stderr}.each do |key, stream|
|
95
95
|
Thread.new do
|
96
|
-
while wait_thr.alive? && !key?(:timed_out) do
|
96
|
+
while wait_thr.alive? && !key?(:timed_out) && !stream.closed? do
|
97
97
|
if(!(char = stream.getc).nil?)
|
98
98
|
case key
|
99
99
|
when :output
|
@@ -116,14 +116,12 @@ class CMD < Hash
|
|
116
116
|
self[:exit_code] = wait_thr.value.to_i
|
117
117
|
end
|
118
118
|
rescue Exception => e
|
119
|
-
|
120
|
-
self[:exit_code]=1 unless(self[:exit_code].nil? || (self[:exit_code] == 0))
|
121
|
-
rescue => e
|
119
|
+
kill_child_processes
|
122
120
|
self[:error] = "#{self[:error]}\nException: #{e.to_s}"
|
123
121
|
self[:exit_code]=1 unless(self[:exit_code].nil? || (self[:exit_code] == 0))
|
124
122
|
end
|
125
123
|
end
|
126
|
-
def
|
124
|
+
def kill_child_processes
|
127
125
|
process = get_child_processes(self[:pid])
|
128
126
|
Sys::ProcTable.ps { |p| process << p if(p.pid == self[:pid]) }
|
129
127
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: execute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.49
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|