scripts/coverage.py: --run: swallow KeyboardInterrupt

It is quite common to stop a tested scylla process with ^C, which will
raise KeyboardInterrupt from subprocess.run(). Catch and swallow this
exception, allowing the post-processing to continue.
The interrupted process has to handle the interrupt correctly too --
flush the coverage data even on premature exit -- but this is for
another patch.

Closes #14815
This commit is contained in:
Botond Dénes
2023-07-25 01:14:03 -04:00
committed by Nadav Har'El
parent 2943d3c1b0
commit ed025890e5

View File

@@ -61,7 +61,10 @@ def run(args, executable=None, distinct_id=None):
extra_env = env(executable, distinct_id)
else:
extra_env = env(args[0], distinct_id)
subprocess.check_call(args, env=dict(os.environ, **extra_env))
try:
subprocess.check_call(args, env=dict(os.environ, **extra_env))
except KeyboardInterrupt:
pass # allow process to be shut down with ^C
def generate_coverage_report(path="build/coverage/test", name="tests", input_files=None, verbose=0):