mixlib-shellout 2.0.0.rc.1 → 2.0.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8fa4945eaf8aa4cb4752a4628afc14354af08833
4
+ data.tar.gz: 02403cde281b2f111e03a3156915dd77ea7ead4b
5
+ SHA512:
6
+ metadata.gz: aa41d5f33eb424a8fe436618abb2a18691c236569240a596bea8e765c354aef738a502241785a7bdf7cadc19eecabb4a061122a00586a7447ee1b7da3af99874
7
+ data.tar.gz: bf78f908eae73bec95c57b61af138f0cff4b7efb1f6b32cad7882153ba0e566ccfd00e386c9720af92da7091904c049fcd7a8db221270f4a55019683db48446b
@@ -144,7 +144,7 @@ module Mixlib
144
144
  # cmd = Mixlib::ShellOut.new("apachectl", "start", :user => 'www', :env => nil, :cwd => '/tmp')
145
145
  # cmd.run_command # etc.
146
146
  def initialize(*command_args)
147
- @stdout, @stderr = '', ''
147
+ @stdout, @stderr, @process_status = '', '', ''
148
148
  @live_stdout = @live_stderr = nil
149
149
  @input = nil
150
150
  @log_level = :debug
@@ -229,7 +229,7 @@ module Mixlib
229
229
  # Some patch levels of ruby in wide use (in particular the ruby 1.8.6 on OSX)
230
230
  # segfault when you IO.select a pipe that's reached eof. Weak sauce.
231
231
  def open_pipes
232
- @open_pipes ||= [child_stdout, child_stderr]
232
+ @open_pipes ||= [child_stdout, child_stderr, child_process_status]
233
233
  end
234
234
 
235
235
  # Keep this unbuffered for now
@@ -241,11 +241,10 @@ module Mixlib
241
241
 
242
242
  def attempt_buffer_read
243
243
  ready = IO.select(open_pipes, nil, nil, READ_WAIT_TIME)
244
- if ready && ready.first.include?(child_stdout)
245
- read_stdout_to_buffer
246
- end
247
- if ready && ready.first.include?(child_stderr)
248
- read_stderr_to_buffer
244
+ if ready
245
+ read_stdout_to_buffer if ready.first.include?(child_stdout)
246
+ read_stderr_to_buffer if ready.first.include?(child_stderr)
247
+ read_process_status_to_buffer if ready.first.include?(child_process_status)
249
248
  end
250
249
  ready
251
250
  end
@@ -270,6 +269,15 @@ module Mixlib
270
269
  open_pipes.delete(child_stderr)
271
270
  end
272
271
 
272
+ def read_process_status_to_buffer
273
+ while chunk = child_process_status.read_nonblock(READ_SIZE)
274
+ @process_status << chunk
275
+ end
276
+ rescue Errno::EAGAIN
277
+ rescue EOFError
278
+ open_pipes.delete(child_process_status)
279
+ end
280
+
273
281
  def fork_subprocess
274
282
  initialize_ipc
275
283
 
@@ -311,12 +319,14 @@ module Mixlib
311
319
  # assume everything went well.
312
320
  def propagate_pre_exec_failure
313
321
  begin
314
- e = Marshal.load child_process_status
322
+ attempt_buffer_read until child_process_status.eof?
323
+ e = Marshal.load(@process_status)
315
324
  raise(Exception === e ? e : "unknown failure: #{e.inspect}")
316
- rescue EOFError # If we get an EOF error, then the exec was successful
325
+ rescue ArgumentError # If we get an ArgumentError error, then the exec was successful
317
326
  true
318
327
  ensure
319
328
  child_process_status.close
329
+ open_pipes.delete(child_process_status)
320
330
  end
321
331
  end
322
332
 
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class ShellOut
3
- VERSION = "2.0.0.rc.1"
3
+ VERSION = "2.0.0.rc.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-shellout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc.1
5
- prerelease: 6
4
+ version: 2.0.0.rc.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Opscode
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-11-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '2.0'
30
27
  description: Run external commands on Unix or Windows
@@ -37,34 +34,33 @@ extra_rdoc_files:
37
34
  files:
38
35
  - LICENSE
39
36
  - README.md
37
+ - lib/mixlib/shellout.rb
40
38
  - lib/mixlib/shellout/exceptions.rb
41
39
  - lib/mixlib/shellout/unix.rb
42
40
  - lib/mixlib/shellout/version.rb
43
- - lib/mixlib/shellout/windows/core_ext.rb
44
41
  - lib/mixlib/shellout/windows.rb
45
- - lib/mixlib/shellout.rb
42
+ - lib/mixlib/shellout/windows/core_ext.rb
46
43
  homepage: http://wiki.opscode.com/
47
44
  licenses: []
45
+ metadata: {}
48
46
  post_install_message:
49
47
  rdoc_options: []
50
48
  require_paths:
51
49
  - lib
52
50
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
51
  requirements:
55
- - - ! '>='
52
+ - - ">="
56
53
  - !ruby/object:Gem::Version
57
54
  version: 1.9.3
58
55
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
56
  requirements:
61
- - - ! '>'
57
+ - - ">"
62
58
  - !ruby/object:Gem::Version
63
59
  version: 1.3.1
64
60
  requirements: []
65
61
  rubyforge_project:
66
- rubygems_version: 1.8.29
62
+ rubygems_version: 2.4.1
67
63
  signing_key:
68
- specification_version: 3
64
+ specification_version: 4
69
65
  summary: Run external commands on Unix or Windows
70
66
  test_files: []