mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
switch from open4 -> mixlib-shellout
This commit is contained in:
parent
76996144d2
commit
938d13a7dc
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…
Reference in a new issue