mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
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:
commit
084aee1bd3
2 changed files with 7 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue