[arcanist] rm -f for write protected temp files
authorNick Desaulniers <ndesaulniers@google.com>
Mon, 17 Apr 2023 20:18:16 +0000 (13:18 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Mon, 17 Apr 2023 20:19:02 +0000 (13:19 -0700)
When running `arc diff` on a newly added file,
utils/arcanist/clang-format.sh is run. For new files there is no change,
but the script will bail. Without the use of the -f flag, we get
interactive prompts like:
rm: remove write-protected regular file '/tmp/tmp.ReMybrBw35'?

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D148555

utils/arcanist/clang-format.sh

index cc115f0..c8ae017 100755 (executable)
@@ -36,7 +36,7 @@ cp -p "${src_file}" "${formatted_file}"
 
 cleanup() {
   rc=$?
-  rm "${formatted_file}" "${original_file}"
+  rm -f "${formatted_file}" "${original_file}"
   exit ${rc}
 }
 trap 'cleanup' INT HUP QUIT TERM EXIT