Skip to content

Commit 5746b75

Browse files
committed
Remove useless Dir.chdir in Terraform::Runner
Dir.glob returns full file pathnames that have the dir_path stipped before adding to the zipfile anyway so the Dir.chdir is entirely useless here.
1 parent 707fe67 commit 5746b75

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/terraform/runner.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ def encoded_zip_from_directory(template_path)
170170
Tempfile.create(%w[opentofu-runner-payload .zip]) do |zip_file_path|
171171
_log.debug("Create #{zip_file_path}")
172172
Zip::File.open(zip_file_path, Zip::File::CREATE) do |zipfile|
173-
Dir.chdir(dir_path)
174-
Dir.glob("**/*").select { |fn| File.file?(fn) }.each do |file|
173+
Dir.glob(File.join(dir_path, "/**/*")).select { |fn| File.file?(fn) }.each do |file|
175174
_log.debug("Adding #{file}")
176175
zipfile.add(file.sub("#{dir_path}/", ''), file)
177176
end

0 commit comments

Comments
 (0)