lib/bolt/transport/docker/connection.rb in bolt-3.8.1 vs lib/bolt/transport/docker/connection.rb in bolt-3.9.0
- old
+ new
@@ -25,10 +25,14 @@
else
Bolt::Shell::Bash.new(target, self)
end
end
+ def reset_cwd?
+ true
+ end
+
# The full ID of the target container
#
# @return [String] The full ID of the target container
def container_id
@container_info["Id"]
@@ -72,11 +76,10 @@
def execute(command)
args = []
# CODEREVIEW: Is it always safe to pass --interactive?
args += %w[--interactive]
args += %w[--tty] if target.options['tty']
- args += %W[--env DOCKER_HOST=#{@docker_host}] if @docker_host
args += @env_vars if @env_vars
if target.options['shell-command'] && !target.options['shell-command'].empty?
# escape any double quotes in command
command = command.gsub('"', '\"')
@@ -84,10 +87,10 @@
end
docker_command = %w[docker exec] + args + [container_id] + Shellwords.split(command)
@logger.trace { "Executing: #{docker_command.join(' ')}" }
- Open3.popen3(*docker_command)
+ Open3.popen3(env_hash, *docker_command)
rescue StandardError
@logger.trace { "Command aborted" }
raise
end