execute 0.1.69 → 0.1.70
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/execute.rb +20 -24
- 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: 8d820fe6edcfc7745cd41c4641ee684f3f04189d
|
4
|
+
data.tar.gz: 67bb0788cf8a8b05709f5aa731292907dee027f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b59ee96cc2838709d35b124c6a8f6e85c645a583b1c1bddd773032a881c89f502012ecc86f7f49a4b3cac0d74be41a0e9c6a27b7114ec9b5b408a50bfaf35e7
|
7
|
+
data.tar.gz: 3d7e5eced8906cae24f7ef5dab897d21790fd8aef4fa870e820849478c135414fa0fbf7836bec9545baf30ed8c3690713462743a0915f1e5cef3cabb881fd67f
|
data/lib/execute.rb
CHANGED
@@ -85,24 +85,21 @@ class Execute < Hash
|
|
85
85
|
|
86
86
|
unless(timeout.nil?)
|
87
87
|
start_time = Time.now
|
88
|
-
end_loop = stop_threads
|
89
88
|
threads << Thread.new do
|
90
89
|
begin
|
91
|
-
while wait_thr.alive?
|
90
|
+
while wait_thr.alive? do
|
92
91
|
if((Time.now - start_time).to_f > timeout)
|
93
|
-
self[:timed_out] = true
|
94
|
-
mutex.synchronize { stop_threads = true }
|
92
|
+
self[:timed_out] = true
|
95
93
|
interrupt
|
96
|
-
|
94
|
+
mutex.synchronize {stop_threads = true }
|
97
95
|
else
|
98
96
|
sleep(1)
|
99
97
|
Thread.pass
|
100
98
|
end
|
101
|
-
|
99
|
+
break if(stop_threads)
|
102
100
|
end
|
103
|
-
rescue Exception
|
101
|
+
rescue Exception
|
104
102
|
mutex.synchronize { stop_threads = true }
|
105
|
-
Thread.exit
|
106
103
|
end
|
107
104
|
end
|
108
105
|
end
|
@@ -110,30 +107,29 @@ class Execute < Hash
|
|
110
107
|
{:output => stdout,:error => stderr}.each do |key, stream|
|
111
108
|
threads << Thread.new do
|
112
109
|
begin
|
113
|
-
end_loop = stop_threads
|
114
110
|
last_pass_time = Time.now
|
115
|
-
while wait_thr.alive?
|
116
|
-
|
117
|
-
|
111
|
+
while wait_thr.alive? do
|
112
|
+
while !stream.closed? &&
|
113
|
+
!(char = stream.getc).nil? do
|
114
|
+
case key
|
115
|
+
when :output
|
116
|
+
output << char
|
117
|
+
putc char if(self[:echo_output])
|
118
|
+
when :error
|
119
|
+
error << char
|
120
|
+
end
|
121
|
+
|
122
|
+
if(wait_thr.alive? && ((Time.now - last_pass_time).to_i > 15))
|
118
123
|
last_pass_time = Time.now
|
119
|
-
sleep(0.1)
|
120
124
|
Thread.pass
|
121
|
-
else
|
122
|
-
case key
|
123
|
-
when :output
|
124
|
-
output << char
|
125
|
-
putc char if(self[:echo_output])
|
126
|
-
when :error
|
127
|
-
error << char
|
128
|
-
end
|
129
125
|
end
|
130
126
|
end
|
131
|
-
|
127
|
+
break if(stop_threads)
|
128
|
+
sleep(0.1)
|
132
129
|
end
|
133
|
-
mutex.synchronize { stop_threads = true }
|
130
|
+
mutex.synchronize { stop_threads = true }
|
134
131
|
rescue Exception
|
135
132
|
mutex.synchronize { stop_threads = true }
|
136
|
-
Thread.exit
|
137
133
|
end
|
138
134
|
end
|
139
135
|
end
|
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.70
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|