-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new ExitHandler API as an alternative to ExitGuard (vercel/turbor…
…epo#8547) ## Why? I need a better system for handling process exit to handle flushing to cache hit statistics (vercel/turborepo#8286). ## What? - Supports letting another thing listen for <kbd>ctrl</kbd> + <kbd>c</kbd>. In the case of next-server, we need to let node.js own and configure these signal handlers. - Supports setting up a <kbd>ctrl</kbd> + <kbd>c</kbd> handler for you, but now explicitly panics if you would try to set up multiple global <kbd>ctrl</kbd> + <kbd>c</kbd> listeners. - Allows async work to happen during cleanup. This wasn't possible using `Drop` because `Drop` isn't async. - Allows cleanup work to be scheduled after application initialization, potentially making the API a bit more flexible. ## Testing Instructions ``` cargo test -p turbopack-trace-utils ``` Add some `println!()` logging to the end of the `on_exit` future in turbopack-cli. ``` TURBOPACK_TRACING=overview cargo run -p turbopack-cli -- dev ``` Hit `ctrl+c` and see that my `println!()` runs, so I know the tracing flush finishes.
- Loading branch information
Showing
3 changed files
with
206 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters