From d35b4ed0931961f393b1417457c1f57f9e184daf Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Mon, 3 Oct 2022 11:55:33 +1100
Subject: [PATCH] code_clean: convert an error to a warning when output can't
 be created

---
 utils_maintenance/code_clean.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/utils_maintenance/code_clean.py b/utils_maintenance/code_clean.py
index 996d36b..86e9fe8 100755
--- a/utils_maintenance/code_clean.py
+++ b/utils_maintenance/code_clean.py
@@ -1187,7 +1187,12 @@ def wash_source_with_edits(arg_group: Tuple[str, str, str, str, bool, Any]) -> N
             keep_edits=False,
         )
         if not os.path.exists(output):
-            raise Exception("Failed to produce output file: " + output)
+            # raise Exception("Failed to produce output file: " + output)
+
+            # NOTE(@campbellbarton): This fails very occasionally and needs to be investigated why.
+            # For now skip, as it's disruptive to force-quit in the middle of all other changes.
+            print("Failed to produce output file, skipping:", output)
+            return
 
         output_bytes = file_as_bytes(output)
         # Dummy value that won't cause problems.
-- 
GitLab