fulmar-shell 1.6.0 → 1.6.1

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/fulmar/shell.rb +27 -18
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fc5bb14a5ba3fd7793238ee0e27c9e5261d958f
4
- data.tar.gz: e4266432900391b2580dcc65609f38daebf9f3b1
3
+ metadata.gz: 07c5c0cf088d46e90387950e52896969cf0db870
4
+ data.tar.gz: b78a90442cd9754b781d495dceba2e2ca2790cf6
5
5
  SHA512:
6
- metadata.gz: 96cb5b258fdb9c2187bee07ab4b86c9fa65930acec3132a0eda2fa6507d535b60c15a1fbc392e1efe37140c85fad8fec1a4c63ebd4b33beb27c0b30f8ff0d3ef
7
- data.tar.gz: 3b37acc54f5b39c6118dd1293b4d71ce2ad15890126eb25263f883e02a1a636876c14fe6e6de683f32d1890496f29440e23e0fdba91e86a7f9ba068b584c340b
6
+ metadata.gz: 332a535c24266d9ebfdb9388ae97d26ab103cbd64fef6569dbf12d6ac23f37c2328236b58e77245e40faa161f22b885cceef4c7d08d6e66268b5781814d035ab
7
+ data.tar.gz: d6aa30cc0ae1db82448ead093e46899aaa22c01b4539e77c3d25557a0e098c0e850e8aa9465f9bf8352340ec29e4cb9f42f35c44aa13cfa6ac8733fdcdcca278
data/lib/fulmar/shell.rb CHANGED
@@ -5,7 +5,7 @@ require 'open3'
5
5
  module Fulmar
6
6
  # Implements simple access to shell commands
7
7
  class Shell
8
- VERSION = '1.6.0'
8
+ VERSION = '1.6.1'
9
9
 
10
10
  attr_accessor :debug, :last_output, :last_error, :quiet, :strict
11
11
  attr_reader :path
@@ -88,25 +88,34 @@ module Fulmar
88
88
  def execute(command, error_message)
89
89
  # Ladies and gentleman: More debug, please!
90
90
  puts command if @debug
91
-
92
- stdin, stdout, stderr, wait_thr = Open3.popen3(environment, command)
93
-
94
- # Remove annoying newlines at the end
95
- @last_output = stdout.readlines.collect(&:chomp)
96
- @last_error = stderr.readlines.collect(&:chomp)
97
-
98
- stdin.close
99
- stdout.close
100
- stderr.close
101
-
102
- @last_error.each { |line| puts line } unless @quiet
103
-
104
- if @strict and wait_thr.value != 0
105
- dump_error_message(command)
106
- fail error_message
91
+ return_value = -1
92
+
93
+ Open3.popen3(environment, command) do |_stdin, stdout, stderr, wait_thread|
94
+ Thread.new do
95
+ stdout.each do |line|
96
+ @last_value << line
97
+ puts line unless @quiet
98
+ end
99
+ end
100
+
101
+ Thread.new do
102
+ stderr.each do |line|
103
+ @last_error << line
104
+ puts line unless @quiet
105
+ end
106
+ end
107
+
108
+ _stdin.close
109
+
110
+ return_value = wait_thread.value
111
+
112
+ if @strict and return_value != 0
113
+ dump_error_message(command)
114
+ fail error_message
115
+ end
107
116
  end
108
117
 
109
- wait_thr.value == 0
118
+ return_value == 0
110
119
  end
111
120
 
112
121
  def escape_for_sh(text)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fulmar-shell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerrit Visscher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.4.5.1
76
+ rubygems_version: 2.5.1
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Small service to run shell commands on a local or remote shell