Skip to content

Commit 3ee9f83

Browse files
Fix shutdown blocking and startup order in dev-electron script
- Use .unref() on the SIGKILL grace period timer so shutdown exits immediately instead of unconditionally blocking for 1.2 seconds - Move cleanupStaleDevApps() before startWatchers() to ensure stale processes are cleaned up before any new activity begins Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
1 parent 1633fc6 commit 3ee9f83

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

apps/desktop/scripts/dev-electron.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,13 @@ async function shutdown(exitCode) {
184184

185185
await stopApp();
186186
killChildTree("TERM");
187-
await new Promise((resolve) => {
188-
setTimeout(resolve, childTreeGracePeriodMs);
189-
});
190-
killChildTree("KILL");
187+
setTimeout(() => killChildTree("KILL"), childTreeGracePeriodMs).unref();
191188

192189
process.exit(exitCode);
193190
}
194191

195-
startWatchers();
196192
cleanupStaleDevApps();
193+
startWatchers();
197194
startApp();
198195

199196
process.once("SIGINT", () => {

0 commit comments

Comments
 (0)