From 69427da8c9ef538b7741ac7a367f7b947628415e Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Wed, 1 Feb 2023 14:52:27 -0800 Subject: [PATCH] Handle KeyboardInterrupt during repo sync If interrupt signal is sent to repo process while sync is running, repo prints stack trace for each concurrent job that is currently running with no useful information. Instead, this change captures KeyboardInterrupt in each process and prints one line about current project that is being processed. Change-Id: Ieca760ed862341939396b8186ae04128d769cd56 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/357135 Reviewed-by: Joanna Wang Tested-by: Josip Sokcevic --- subcmds/sync.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subcmds/sync.py b/subcmds/sync.py index 4b7e81df..b80d97b8 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -498,6 +498,8 @@ later is required to fix a server side protocol bug. print('error: Cannot fetch %s from %s' % (project.name, project.remote.url), file=sys.stderr) + except KeyboardInterrupt as e: + print(f'Keyboard interrupt while processing {project.name}') except GitError as e: print('error.GitError: Cannot fetch %s' % str(e), file=sys.stderr) except Exception as e: