diff options
author | Josip Sokcevic <sokcevic@google.com> | 2023-02-01 14:52:27 -0800 |
---|---|---|
committer | Josip Sokcevic <sokcevic@google.com> | 2023-02-01 23:41:11 +0000 |
commit | 69427da8c9ef538b7741ac7a367f7b947628415e (patch) | |
tree | aa57ba29fc71ef011a664055f133e24398ffaea3 | |
parent | dccf38e34f5ce48a8583df320d7c5e203d2a9cf2 (diff) | |
download | git-repo-69427da8c9ef538b7741ac7a367f7b947628415e.tar.gz |
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 <jojwang@google.com>
Tested-by: Josip Sokcevic <sokcevic@google.com>
-rw-r--r-- | subcmds/sync.py | 2 |
1 files changed, 2 insertions, 0 deletions
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. | |||
498 | print('error: Cannot fetch %s from %s' | 498 | print('error: Cannot fetch %s from %s' |
499 | % (project.name, project.remote.url), | 499 | % (project.name, project.remote.url), |
500 | file=sys.stderr) | 500 | file=sys.stderr) |
501 | except KeyboardInterrupt as e: | ||
502 | print(f'Keyboard interrupt while processing {project.name}') | ||
501 | except GitError as e: | 503 | except GitError as e: |
502 | print('error.GitError: Cannot fetch %s' % str(e), file=sys.stderr) | 504 | print('error.GitError: Cannot fetch %s' % str(e), file=sys.stderr) |
503 | except Exception as e: | 505 | except Exception as e: |