From dd938754e7e0f63d12fe09f9510fa1fcf2840e72 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Wed, 26 Apr 2023 15:38:03 -0400 Subject: [PATCH] fix(dev): forcibly kill app server during dev --- .changeset/soft-laws-cry.md | 5 +++++ packages/remix-dev/devServer_unstable/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/soft-laws-cry.md diff --git a/.changeset/soft-laws-cry.md b/.changeset/soft-laws-cry.md new file mode 100644 index 00000000000..e67e057df4d --- /dev/null +++ b/.changeset/soft-laws-cry.md @@ -0,0 +1,5 @@ +--- +"@remix-run/dev": patch +--- + +forcibly kill app server during dev diff --git a/packages/remix-dev/devServer_unstable/index.ts b/packages/remix-dev/devServer_unstable/index.ts index 44d57abb23e..822f58500d1 100644 --- a/packages/remix-dev/devServer_unstable/index.ts +++ b/packages/remix-dev/devServer_unstable/index.ts @@ -206,5 +206,8 @@ let kill = async (p?: execa.ExecaChildProcess) => { await execa("taskkill", ["/pid", String(p.pid), "/f", "/t"]); return; } - p.kill(); + + // wait one tick of the event loop so that we guarantee app server gets killed before proceeding + p.kill("SIGTERM", { forceKillAfterTimeout: 0 }); + await new Promise((resolve) => setTimeout(resolve, 0)); };