diff options
-rw-r--r-- | quarg/main.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/quarg/main.py b/quarg/main.py index 9532ba7..f21327d 100644 --- a/quarg/main.py +++ b/quarg/main.py @@ -144,6 +144,10 @@ def main(): print(formatter.format_from(row)) except exc.SQLAlchemyError as err: errx(err) + except KeyboardInterrupt: + session.rollback() + session.close() + sys.exit(1) print(f'Query returned {len(rows)} lines in {time:.4f} seconds.', file=sys.stderr) |