execute 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cmd.rb +5 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc27bbecf5a0307584ceffffc4f3120a42b2ffe0
4
- data.tar.gz: cde8eb6ea12750cecc95213552e541dda1ca5d52
3
+ metadata.gz: 3761cc1d98bba34e8c05ca3a698dceb00b68e21d
4
+ data.tar.gz: ad5a8e876622913dfc05d0f556d27413b33bda33
5
5
  SHA512:
6
- metadata.gz: ff91688095593a7b531fa5da37bf84253236caf624929506ca66afd769add5a3cf2a4535f0d91aee11da7e215ac60ea480772e70c0dfc0b25e7c3d34327c2d3d
7
- data.tar.gz: 1b8ddacfe671c96e1a558061a3d37bfad4b7aac5d05244fd956841bb0616584b0be5476d7dc627d84bd2070d36bef27ccf1415b02e97e666ef12450237672a4a
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
- begin
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].nil? || self[:error].empty?)
60
+ exception_text = self[:output] if(self[:error].empty?)
59
61
  raise exception_text
60
62
  end
61
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall