scripts/ci/gitlab-pipeline-status: handle keyboard interrupts

So that exits based on user requests are handled more gracefully.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20200904164258.240278-6-crosa@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Cleber Rosa 2020-09-04 12:42:56 -04:00 committed by Thomas Huth
parent 91641d555a
commit 79df438eeb
1 changed files with 4 additions and 2 deletions

View File

@ -132,7 +132,7 @@ def main():
""" """
parser = create_parser() parser = create_parser()
args = parser.parse_args() args = parser.parse_args()
success = False
try: try:
if args.wait: if args.wait:
success = wait_on_pipeline_success( success = wait_on_pipeline_success(
@ -145,9 +145,11 @@ def main():
args.commit) args.commit)
success = status['status'] == 'success' success = status['status'] == 'success'
except Exception as error: # pylint: disable=W0703 except Exception as error: # pylint: disable=W0703
success = False
if args.verbose: if args.verbose:
print("ERROR: %s" % error.args[0]) print("ERROR: %s" % error.args[0])
except KeyboardInterrupt:
if args.verbose:
print("Exiting on user's request")
if success: if success:
if args.verbose: if args.verbose: