diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index cf91bafa60..02fc3d5e05 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -148,8 +148,7 @@ module Commands cmds = internal_commands + internal_developer_commands + internal_commands_aliases file = HOMEBREW_REPOSITORY/"completions/internal_commands_list.txt" - file.delete if file.exist? - file.write(cmds.sort.join("\n") + "\n") + file.atomic_write(cmds.sort.join("\n") + "\n") end def rebuild_commands_completion_list @@ -157,7 +156,6 @@ module Commands HOMEBREW_CACHE.mkpath file = HOMEBREW_CACHE/"all_commands_list.txt" - file.delete if file.exist? - file.write(commands(aliases: true).sort.join("\n") + "\n") + file.atomic_write(commands(aliases: true).sort.join("\n") + "\n") end end