[clang] [clang][test] Rewrote test to work with lit internal shell syntax (PR #105902)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 16:29:33 PDT 2024


================
@@ -0,0 +1,22 @@
+import argparse
+import os
+
+def get_file_size(file_path):
+    try:
+        return os.path.getsize(file_path)
+    except:
+        print(f"Unable to get file size of {file_path}")
+        return None
----------------
ilovepi wrote:

Is the `try/except` better than just letting the exception propagate up through main? I'm fine w/ it, but I wonder if `print` is better than the unhandled exception? it also doesn't fail, does it? So I don't think you'd return an error code if this didn't succeed, would you?

https://github.com/llvm/llvm-project/pull/105902


More information about the cfe-commits mailing list