Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

use Tempfile.open with block instead of Tempfile.new with explicit unlink

Ivan Kuchin2e75df8af1e2
diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
index 12afbf367d1..b9d30572905 100644
--- a/lib/tasks/backup.rake
+++ b/lib/tasks/backup.rake
@@ -95,11 +95,11 @@ namespace :backup do
end
def with_config_file(config, &blk)
- file = Tempfile.new('op_pg_config')
- file.write "*:*:*:*:#{config[:password]}"
- file.close
- blk.yield file.path
- file.unlink
+ Tempfile.open('op_pg_config') do |file|
+ file.write "*:*:*:*:#{config[:password]}"
+ file.close
+ blk.yield file.path
+ end
end
def sql_dump_tempfile(config)