From 6ee7294da6f1ba3734e99480505b19cabf1423cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Fri, 26 Jan 2024 13:24:08 +0100 Subject: [PATCH] Catch OSError so that Ctrl-c works for ERT _base_service.py registers an interrupt handler that translates ctrl-c to an OSError. Since this is not caught, the main thread dies, but the remaining threads continue (but inherits the same interrupt handler). Co-authored-by: Sondre Sortland --- src/ert/cli/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ert/cli/main.py b/src/ert/cli/main.py index 69a609dd1d4..e25e6d439de 100644 --- a/src/ert/cli/main.py +++ b/src/ert/cli/main.py @@ -139,7 +139,8 @@ def run_cli(args: Namespace, _: Any = None) -> None: try: monitor.monitor(tracker.track()) - except (SystemExit, KeyboardInterrupt): + except (SystemExit, KeyboardInterrupt, OSError): + # _base_service.py translates CTRL-c to OSError print("\nKilling simulations...") tracker.request_termination()