Skip to content

Commit e0f552a

Browse files
committed
Changing working directory before executing untar
1 parent 50db2ec commit e0f552a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/instance_agent/platform/linux_util.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,18 @@ def self.script_executable?(path)
4040

4141
def self.extract_tar(bundle_file, dst)
4242
FileUtils.mkdir_p(dst)
43-
execute_tar_command("/bin/tar -xpsf #{bundle_file} -C #{dst}")
43+
working_dir = FileUtils.pwd()
44+
FileUtils.cd(dst)
45+
execute_tar_command("/bin/tar -xpsf #{bundle_file}")
46+
FileUtils.cd(working_dir)
4447
end
4548

4649
def self.extract_tgz(bundle_file, dst)
4750
FileUtils.mkdir_p(dst)
48-
execute_tar_command("/bin/tar -zxpsf #{bundle_file} -C #{dst}")
51+
working_dir = FileUtils.pwd()
52+
FileUtils.cd(dst)
53+
execute_tar_command("/bin/tar -zxpsf #{bundle_file}")
54+
FileUtils.cd(working_dir)
4955
end
5056

5157
def self.supports_process_groups?()

0 commit comments

Comments
 (0)