Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify manual graceful shutdown in dev server #51078

Merged
merged 5 commits into from
Jun 10, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ Next.js will automatically load the latest version of your application in the ba

Sometimes you might want to run some cleanup code on process signals like `SIGTERM` or `SIGINT`.
leerob marked this conversation as resolved.
Show resolved Hide resolved

You can do that by setting the env variable `NEXT_MANUAL_SIG_HANDLE` to `true` and then register a handler for that signal inside your `_document.js` file. Please note that you need to register env variable directly in the system env variable, not in the `.env` file.
You can set the env variable `NEXT_MANUAL_SIG_HANDLE` to `true` and then register a handler for that signal inside your `_document.js` file. Please note that you need to register the env variable directly in the system env variable, not in the `.env` file.
leerob marked this conversation as resolved.
Show resolved Hide resolved

> **Note**: Manual signal handling is not available in `next dev`.

```json filename="package.json"
{
"scripts": {
"dev": "NEXT_MANUAL_SIG_HANDLE=true next dev",
"dev": "next dev",
"build": "next build",
"start": "NEXT_MANUAL_SIG_HANDLE=true next start"
}
Expand Down