Skip to content

Commit

Permalink
fix(dev): kill app server when remix dev terminates
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Aug 28, 2023
1 parent 74e11ca commit 764e9b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-chefs-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

kill app server when remix dev terminates
7 changes: 7 additions & 0 deletions packages/remix-dev/devServer_unstable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import prettyMs from "pretty-ms";
import execa from "execa";
import express from "express";
import pc from "picocolors";
import exitHook from "exit-hook";

import * as Channel from "../channel";
import { type Manifest } from "../manifest";
Expand Down Expand Up @@ -267,6 +268,12 @@ export let serve = async (

server.listen(options.port);

exitHook(() => {
state.appServer?.pid && kill(state.appServer.pid);
websocket.close();
server.close();
});

return new Promise(() => {}).finally(async () => {
state.appServer?.pid && (await kill(state.appServer.pid));
websocket.close();
Expand Down

0 comments on commit 764e9b1

Please sign in to comment.