@devries-cameron20 / t3code-1 / commits / 310fd0b187
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Wait for child process tree shutdown before forcing kill

- add `childTreeGracePeriodMs` constant for shutdown timing - await grace period after `TERM` before sending `KILL` to avoid dev process leaks

Julius Marminge committed Mar 3, 2026 at 22:43 UTC 310fd0b187ec20930b2ac5cbc50bcc7ee653524c
1 file changed +5 -3
apps/desktop/scripts/dev-electron.mjs
+5 -3
@@ -14,6 +14,7 @@ const watchedDirectories = [
14 ];
15 const forcedShutdownTimeoutMs = 1_500;
16 const restartDebounceMs = 120;
17 +const childTreeGracePeriodMs = 1_200;
18
19 await waitOn({
20 resources: [`tcp:${port}`, ...requiredFiles.map((filePath) => `file:${filePath}`)],
@@ -183,9 +184,10 @@ async function shutdown(exitCode) {
184
185 await stopApp();
186 killChildTree("TERM");
186 - setTimeout(() => {
187 - killChildTree("KILL");
188 - }, 1_200).unref();
187 + await new Promise((resolve) => {
188 + setTimeout(resolve, childTreeGracePeriodMs);
189 + });
190 + killChildTree("KILL");
191
192 process.exit(exitCode);
193 }