Skip to content

Commit 25bf5f9

Browse files
author
Kevin Paulisse
committed
It's OK if the directory we are removing doesn't exist
1 parent 86a6dc9 commit 25bf5f9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/octocatalog-diff/util/scriptrunner.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ def log(priority, message, logger = @logger)
9292
def temp_script(script)
9393
raise Errno::ENOENT, "Script '#{script}' not found" unless File.file?(script)
9494
temp_dir = Dir.mktmpdir
95-
at_exit { FileUtils.remove_entry_secure temp_dir }
95+
at_exit do
96+
begin
97+
FileUtils.remove_entry_secure temp_dir
98+
rescue Errno::ENOENT # rubocop:disable Lint/HandleExceptions
99+
# OK if the directory doesn't exist since we're trying to remove it anyway
100+
end
101+
end
96102
temp_file = File.join(temp_dir, File.basename(script))
97103
File.open(temp_file, 'w') { |f| f.write(File.read(script)) }
98104
FileUtils.chmod 0o755, temp_file

0 commit comments

Comments
 (0)