[projects/pld-builder.new] rebuild-kernel-packages: stop on Ctrl+C without a traceback
arekm
arekm at pld-linux.org
Sun Nov 8 00:32:43 CET 2026
commit 86b1d790857690ca6feaf598e23151c763a242fe
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Nov 7 23:44:08 2026 +0100
rebuild-kernel-packages: stop on Ctrl+C without a traceback
Ctrl+C ended the script with a Python traceback. Now it prints
"Interrupted." and exits with status 130.
client/rebuild-kernel-packages.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/client/rebuild-kernel-packages.py b/client/rebuild-kernel-packages.py
index 06d9a75..aa1d89e 100755
--- a/client/rebuild-kernel-packages.py
+++ b/client/rebuild-kernel-packages.py
@@ -7,6 +7,7 @@ import functools
import os
import shlex
import subprocess
+import sys
import rpm
@@ -255,6 +256,11 @@ def main():
run_command(shlex.split(command), verbose=args.verbose, dry_run=args.dry_run, quiet=False)
if __name__ == "__main__":
- main()
+ try:
+ main()
+ except KeyboardInterrupt:
+ # requests sent so far stay queued
+ print('\nInterrupted.', file=sys.stderr)
+ sys.exit(130)
# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/0fe372e62d4e92cd30ed562a93b2531e2d750ed1
More information about the pld-cvs-commit
mailing list