Handling process exit signals in a Node.js application using Effect with a `ManagedRuntime` invol...

What is the recommended way to deal with process exit signals (for example through ctrl+c) when NOT using NodeRuntime.runMain but having multiple entry points (eg. in a express app) and using a ManagedRuntime?

Do we somehow (?) add all the listeners ourselfs (kind like runMain does) in our ManagedRuntime?

Here is a super simple example. The interrupt is not logged on ctrl+c:
await Effect.runPromise(
  Effect.sleep(5000).pipe(Effect.onInterrupt(() => Effect.log("interrupted"))),
);
Was this page helpful?