pyiron_base.state.signal module

pyiron_base.state.signal.catch_signals(cleanup)

Context manager to catch signals.

During the with statement a signal handler is installed to catch SIGINT, SIGTERM and SIGABRT. On exit from the statement the default handlers from the operating system are reinstalled. The handler first calles the given cleanup function and then either raises KeyboardInterrupt (on SIGINT) or calls sys.exit (on SIGTERM/SIGABRT).

Raises:
  • KeyboardInterrupt – received SIGINT

  • SystemExit – received SIGTERM or SIGABRT