Skip to content

Commit

Permalink
Merge pull request #13488 from allisonlarson/allison-docker-exec-command
Browse files Browse the repository at this point in the history
Pass docker exec_options to executor as kwargs
  • Loading branch information
allisonlarson authored Aug 15, 2024
2 parents 44056b0 + 7257991 commit c5da008
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 c5da008

Please sign in to comment.