Merge pull request #66 from chef/mixlib-shellout

Merged change 7bc3507a-1e23-40dc-af27-3b5a851c5dac

From review branch mixlib-shellout into master

Signed-off-by: chartmann <chartmann@chef.io>
This commit is contained in:
chef-delivery 2015-10-05 00:49:58 -07:00
commit 084aee1bd3
2 changed files with 7 additions and 15 deletions

View file

@ -1,14 +1,7 @@
# encoding: utf-8
require 'etc'
require 'rbconfig'
if IO.respond_to?(:popen4)
def open4(*args)
IO.popen4(*args)
end
else
require 'open4'
end
require 'mixlib/shellout'
module Vulcano::Backends
class Local < Vulcano.backend(1)
@ -76,13 +69,12 @@ module Vulcano::Backends
def initialize(cmd)
@cmd = cmd
pid, stdin, stdout, stderr = open4(cmd)
stdin.close
_, status = Process.waitpid2 pid
shellout = Mixlib::ShellOut.new(cmd)
shellout.run_command
@stdout = stdout.read
@stderr = stderr.read
@exit_status = status.exitstatus
@stdout = shellout.stdout
@stderr = shellout.stderr
@exit_status = shellout.exitstatus
rescue Errno::ENOENT => _
@exit_status ||= 1
end

View file

@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'rspec', '~> 3.3'
spec.add_dependency 'rspec-its', '~> 1.2'
spec.add_dependency 'winrm', '~> 1.3'
spec.add_dependency 'open4', '~> 1.3'
spec.add_dependency 'mixlib-shellout', '~> 2'
spec.add_dependency 'specinfra', '~> 2.40'
spec.add_dependency 'docker-api', '~> 1.22'
end