diff options
author | Benjamin Schubert <contact@benschubert.me> | 2020-01-16 16:05:26 +0000 |
---|---|---|
committer | Benjamin Schubert <contact@benschubert.me> | 2020-01-16 16:05:26 +0000 |
commit | c12c7f596f15842028a46fff0ad062b3b4e2988f (patch) | |
tree | 2f74c3c5488eaa618edc4ac01bd4e1e38a6c90e9 | |
parent | 528b33bddf383b2f46457a12c88b07cba47ff8d6 (diff) | |
parent | ca3096b8f2912215bfbb631fe8fbb42621e10a6f (diff) | |
download | buildstream-c12c7f596f15842028a46fff0ad062b3b4e2988f.tar.gz |
Merge branch 'bschubert/backport-1690' into 'bst-1'
app.py: Also catch SystemError with click.Abort
See merge request BuildStream/buildstream!1701
-rw-r--r-- | buildstream/_frontend/app.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index cb9870c4d..50e1e79b0 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -504,7 +504,10 @@ class App(): choice = click.prompt("Choice:", value_proc=_prefix_choice_value_proc(['continue', 'quit', 'terminate']), default='continue', err=True) - except click.Abort: + except (click.Abort, SystemError): + # In some cases, the readline buffer underlying the prompt gets corrupted on the second CTRL+C + # This throws a SystemError, which doesn't seem to be problematic for the rest of the program + # Ensure a newline after automatically printed '^C' click.echo("", err=True) choice = 'terminate' @@ -599,7 +602,10 @@ class App(): try: choice = click.prompt("Choice:", default='continue', err=True, value_proc=_prefix_choice_value_proc(choices)) - except click.Abort: + except (click.Abort, SystemError): + # In some cases, the readline buffer underlying the prompt gets corrupted on the second CTRL+C + # This throws a SystemError, which doesn't seem to be problematic for the rest of the program + # Ensure a newline after automatically printed '^C' click.echo("", err=True) choice = 'terminate' |