Skip to content

Commit

Permalink
Catch OSError so that Ctrl-c works for ERT
Browse files Browse the repository at this point in the history
_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 <[email protected]>
  • Loading branch information
berland and sondreso committed Jan 26, 2024
1 parent d8e8cc8 commit 6ee7294
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ert/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 6ee7294

Please sign in to comment.