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

fix(remix-serve): handle os signals by closing dev server #2528

Merged
merged 9 commits into from
Apr 7, 2022
3 changes: 2 additions & 1 deletion contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- alex-ketch
- alexuxui
- andrelandgraf
- andrewbrey
- AndrewIngram
- anishpras
- anmolm96
Expand Down Expand Up @@ -254,10 +255,10 @@
- robindrost
- roddds
- RomanSavarin
- rossipedia
- RossJHagan
- RossMcMillan92
- rowinbot
- rossipedia
- rphlmr
- rtabulov
- ruisaraiva19
Expand Down
11 changes: 6 additions & 5 deletions packages/remix-serve/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ let onListen = () => {
};

let app = createApp(buildPath);
let server = process.env.HOST
? app.listen(port, process.env.HOST, onListen)
: app.listen(port, onListen);

if (process.env.HOST) {
app.listen(port, process.env.HOST, onListen);
} else {
app.listen(port, onListen);
}
["SIGTERM", "SIGINT"].forEach((signal) => {
process.once(signal, () => server?.close(console.error));
});