Sha256: 2e9f6298e2ad174bd698b499785ab9c62fa7dadd5830b5176d80071d1c2d6678

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

require 'open3'

module VagrantPlugins::ShellLocal
  class Provisioner < Vagrant.plugin('2', :provisioner)
    def provision
      saved_path, ENV['PATH'] = ENV['PATH'], ENV["VAGRANT_OLD_ENV_PATH"]
      begin
        result = Vagrant::Util::Subprocess.execute(
          *config.command,
          :notify => [:stdout, :stderr],
          :env => {
            PATH: ENV["VAGRANT_OLD_ENV_PATH"]
          },
        ) do |io_name, data|
          @machine.env.ui.info "[#{io_name}] #{data}"
        end
      ensure
        ENV['PATH'] = saved_path
      end

      if !result.exit_code.zero?      
        raise VagrantPlugins::ShellLocal::Errors::NonZeroStatusError.new(config.command, result.exit_code)  
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-shell-local-0.1.0 lib/vagrant-shell-local/provisioner.rb