diff --git a/src/aleph/vm/controllers/__main__.py b/src/aleph/vm/controllers/__main__.py index 62639ee8..3232c82b 100644 --- a/src/aleph/vm/controllers/__main__.py +++ b/src/aleph/vm/controllers/__main__.py @@ -86,6 +86,7 @@ async def handle_persistent_vm(config: Configuration, execution: Union[MicroVM, def callback(): """Callback for the signal handler to stop the VM and cleanup properly on SIGTERM.""" loop.create_task(execution.teardown()) + loop.add_signal_handler(signal.SIGTERM, callback) await process.wait()