The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 21:00 UTC
fix(server): a full disk no longer crashes the server through a failed log write (#34488)
Julius Marminge committed
Nov 11, 2026 at 15:55 UTC
0ad9c9adaead9a21b5f34a7e426e54d5801a7f63
2 files changed
+8
-11
apps/server/src/bin.ts
+8
@@ -30,6 +30,8 @@ async function loadCliMain(): Promise<typeof import("./binMain.ts")> {
30
}
31
}
32
33
+function ignoreOutputError(): void {}
34
+
35
if (
36
isEntrypoint({
37
moduleUrl: import.meta.url,
@@ -37,6 +39,12 @@ if (
39
runtimeMain: import.meta.main,
40
})
41
) {
42
+ // Logs go to stdout and stderr, which may be a closed desktop launcher pipe or a log file on
43
+ // a full disk. Node emits a failed write as an unhandled stream error that crashes the process
44
+ // and skips shutdown, so drop the line instead.
45
+ process.stdout.on("error", ignoreOutputError);
46
+ process.stderr.on("error", ignoreOutputError);
47
+
48
// The launcher owns shutdown until its child exits, so it bypasses the Effect CLI runtime.
49
// A service unit passes nothing, or on Windows the launcher's own flags; help and anything
50
// else go through the full CLI.
apps/server/src/cli/server.ts
-11
@@ -16,13 +16,6 @@ import { type CliServerFlags, resolveServerConfig, sharedServerCommandFlags } fr
16
17
const encodeCommand = Schema.encodeEffect(Schema.fromJsonString(Schema.String));
18
19
-// The desktop launcher reads this process's stdout and stderr. Once it is gone,
20
-// every log write fails, and Node turns an unhandled stream error into a crash
21
-// that skips shutdown and leaves the ownership lock and runtime record behind.
22
-function ignoreClosedLauncherPipe(error: NodeJS.ErrnoException): void {
23
- if (error.code !== "EPIPE" && error.code !== "ERR_STREAM_DESTROYED") throw error;
24
-}
25
-
19
const runServerCommand = Effect.fn("server.runServerCommand")(function* (
20
flags: CliServerFlags,
21
options?: {
@@ -48,10 +41,6 @@ const runServerCommand = Effect.fn("server.runServerCommand")(function* (
41
),
42
);
43
if (config.mode !== "desktop" || config.desktopBootstrapToken === undefined) return yield* run;
51
- yield* Effect.sync(() => {
52
- process.stdout.on("error", ignoreClosedLauncherPipe);
53
- process.stderr.on("error", ignoreClosedLauncherPipe);
54
- });
44
return yield* Effect.raceFirst(
45
run,
46
awaitLauncherLoss().pipe(