execute 0.1.8 → 0.1.9
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 +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3761cc1d98bba34e8c05ca3a698dceb00b68e21d
|
4
|
+
data.tar.gz: ad5a8e876622913dfc05d0f556d27413b33bda33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94327058e207af746d83d56e032e68cc7ecaea6e11fbffee9b7939f1aecac0fcb5c91c8641264e46c53cf38c7c61fcce9bcf72366649018e7dbe44ccba4ef5d
|
7
|
+
data.tar.gz: 60fb7655236f478a8a72480726378e277752e1aa3a5e5f7732a300e09bf8fc172a43fe5075338cd9c0ea3a444d016f450fe9878b9b3966c696a9fd1d3da83f21
|
data/lib/cmd.rb
CHANGED
@@ -23,9 +23,11 @@ class CMD < Hash
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def execute
|
26
|
-
|
26
|
+
self[:output] = ''
|
27
|
+
self[:error] = ''
|
28
|
+
begin
|
27
29
|
puts self[:command] if(self[:echo_command])
|
28
|
-
|
30
|
+
|
29
31
|
output = {output: [], error: [] }
|
30
32
|
Open3.popen3(self[:command]) do |stdin, stdout, stderr, wait_thr|
|
31
33
|
{:output => stdout,:error => stderr}.each do |key, stream|
|
@@ -55,7 +57,7 @@ class CMD < Hash
|
|
55
57
|
|
56
58
|
if((self[:exit_code] != 0) && !self[:ignore_exit_code])
|
57
59
|
exception_text = self[:error]
|
58
|
-
exception_text = self[:output] if(self[:error].
|
60
|
+
exception_text = self[:output] if(self[:error].empty?)
|
59
61
|
raise exception_text
|
60
62
|
end
|
61
63
|
end
|