ci: lsan - wrap git command into try block for debugging (#5595)

This commit is contained in:
Rot127 2025-12-15 16:08:44 +00:00 committed by GitHub
parent fe14cdf1b5
commit b58e9a6a4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,7 +28,11 @@ def get_changed_lines(
# --unified=0 gives hunks like “@@ -L,C +L,C @@” (we care about the + side)
cmd = ["git", "diff", "--unified=0", f"{base_ref}..{head_ref}"]
out = subprocess.check_output(cmd, text=True, stderr=subprocess.DEVNULL)
try:
out = subprocess.check_output(cmd, text=True)
except subprocess.CalledProcessError as e:
print(f"Random failure: stderr: {e.stderr}\nstdout: {e.stdout}\n")
sys.exit(1)
if not out:
return None
@ -96,6 +100,8 @@ def main() -> None:
print(f"Total leaks: {total_leaks}")
print(f"New leaks: {len(leaks)}\n")
print("Note: The leaks can be false positives but are rarely.\n")
indent = " "
if leaks:
print("Memory leaks detected in changed lines:")