Merge pull request #10116 from briancain/fix-run-arg-trigger
Ensure trigger run args are an array prior to join
This commit is contained in:
commit
57c48ee348
|
@ -158,7 +158,8 @@ module Vagrant
|
|||
@machine.ui.detail(I18n.t("vagrant.trigger.run.inline", command: config.inline))
|
||||
else
|
||||
cmd = File.expand_path(config.path, @env.root_path)
|
||||
cmd << " #{config.args.join(' ' )}" if config.args
|
||||
args = Array(config.args)
|
||||
cmd << " #{args.join(' ')}" if !args.empty?
|
||||
cmd = Shellwords.split(cmd)
|
||||
|
||||
@machine.ui.detail(I18n.t("vagrant.trigger.run.script", path: config.path))
|
||||
|
|
|
@ -131,11 +131,11 @@ describe Vagrant::Plugin::V2::Trigger do
|
|||
{info: "hi", run: {inline: "echo 'hi'", env: {"KEY"=>"VALUE"}},
|
||||
exit_codes: [0,50]} }
|
||||
let(:path_block) { {warn: "bye",
|
||||
run: {path: "script.sh", env: {"KEY"=>"VALUE"}},
|
||||
run: {path: "script.sh", args: "HELLO", env: {"KEY"=>"VALUE"}},
|
||||
on_error: :continue} }
|
||||
|
||||
let(:path_block_ps1) { {warn: "bye",
|
||||
run: {path: "script.ps1", env: {"KEY"=>"VALUE"}},
|
||||
run: {path: "script.ps1", args: ["HELLO", "THERE"], env: {"KEY"=>"VALUE"}},
|
||||
on_error: :continue} }
|
||||
|
||||
let(:exit_code) { 0 }
|
||||
|
@ -197,7 +197,7 @@ describe Vagrant::Plugin::V2::Trigger do
|
|||
exit_codes = trigger.exit_codes
|
||||
|
||||
expect(Vagrant::Util::PowerShell).to receive(:execute).
|
||||
with("/vagrant/home/script.ps1", options)
|
||||
with("/vagrant/home/script.ps1", "HELLO", "THERE", options)
|
||||
subject.send(:run, shell_config, on_error, exit_codes)
|
||||
end
|
||||
|
||||
|
@ -227,7 +227,7 @@ describe Vagrant::Plugin::V2::Trigger do
|
|||
exit_codes = trigger.exit_codes
|
||||
|
||||
expect(Vagrant::Util::Subprocess).to receive(:execute).
|
||||
with("/vagrant/home/script.sh", options)
|
||||
with("/vagrant/home/script.sh", "HELLO", options)
|
||||
subject.send(:run, shell_config, on_error, exit_codes)
|
||||
end
|
||||
|
||||
|
@ -243,7 +243,7 @@ describe Vagrant::Plugin::V2::Trigger do
|
|||
exit_codes = trigger.exit_codes
|
||||
|
||||
expect(Vagrant::Util::Subprocess).to receive(:execute).
|
||||
with("/vagrant/home/script.sh", options)
|
||||
with("/vagrant/home/script.sh", "HELLO", options)
|
||||
subject.send(:run, shell_config, on_error, exit_codes)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue