lib/vagrant-host-shell/provisioner.rb in vagrant-host-shell-0.0.2 vs lib/vagrant-host-shell/provisioner.rb in vagrant-host-shell-0.0.3
- old
+ new
@@ -1,14 +1,20 @@
module VagrantPlugins::HostShell
class Provisioner < Vagrant.plugin('2', :provisioner)
def provision
- Vagrant::Util::Subprocess.execute(
+ result = Vagrant::Util::Subprocess.execute(
'/bin/bash',
'-c',
config.inline,
- :notify => [:stdout, :stderr]
+ :notify => [:stdout, :stderr],
+ :workdir => config.cwd
) do |io_name, data|
@machine.env.ui.info "[#{io_name}] #{data}"
end
+
+ if config.abort_on_nonzero && !result.exit_code.zero?
+ raise VagrantPlugins::HostShell::Errors::NonZeroStatusError.new(config.inline, result.exit_code)
+ end
+
end
end
end