Skip to content

Commit

Permalink
Pass docker exec_options to executor as kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonlarson committed Aug 14, 2024
1 parent 44056b0 commit 7257991
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/providers/docker/command/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def exec_command(machine, command, options)
Vagrant::Util::SafeExec.exec(exec_cmd[0], *exec_cmd[1..-1])
else
output = ""
machine.provider.driver.execute(*exec_cmd, exec_options) do |type, data|
machine.provider.driver.execute(*exec_cmd, **exec_options) do |type, data|
output += data
end

Expand Down
11 changes: 11 additions & 0 deletions test/unit/plugins/providers/docker/command/exec_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@
subject.exec_command(machine, command, options)
end
end
describe "with options" do
let(:command) { ["ls"] }
let(:options) { {etc: "something"} }

it "passes the options successfully" do
driver = instance_double("Driver")
expect(driver).to receive(:execute).with("docker", "exec", nil, "ls", {etc: "something"})
allow(machine.provider).to receive(:driver) { driver }
subject.exec_command(machine, command, options)
end
end
describe "without a command" do
let(:argv) { [] }

Expand Down

0 comments on commit 7257991

Please sign in to comment.