The best way to control Claude Code, Codex and more from any computer or phone
fix(desktop): tolerate disk-full console output (#35245)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Unlock Digital Media committed
Nov 14, 2026 at 12:15 UTC
7c52ef7401c23baf8c48db97446c3ef0f721033f
3 files changed
+38
-3
apps/desktop/src/app/stdioErrors.test.ts
new
+22
@@ -0,0 +1,22 @@
1
+import * as NodeOS from "node:os";
2
+import { assert, it } from "vite-plus/test";
3
+
4
+import { handleStdioError } from "./stdioErrors.ts";
5
+
6
+const errorWithCode = (code: string, errno?: number) =>
7
+ Object.assign(new Error(code), { code, errno });
8
+const EDQUOT_ERRNO = NodeOS.constants.errno.EDQUOT;
9
+
10
+it.each(["EPIPE", "ENOSPC"])("ignores %s on console output", (code) => {
11
+ assert.doesNotThrow(() => handleStdioError(errorWithCode(code)));
12
+});
13
+
14
+// Node reports EDQUOT as UNKNOWN because libuv has no name for it.
15
+it.skipIf(EDQUOT_ERRNO === undefined)("ignores EDQUOT on console output", () => {
16
+ assert.doesNotThrow(() => handleStdioError(errorWithCode("UNKNOWN", -(EDQUOT_ERRNO ?? 0))));
17
+});
18
+
19
+it("rethrows other console output errors", () => {
20
+ assert.throws(() => handleStdioError(errorWithCode("EIO")), "EIO");
21
+ assert.throws(() => handleStdioError(errorWithCode("UNKNOWN", -5)), "UNKNOWN");
22
+});
apps/desktop/src/app/stdioErrors.ts
new
+13
@@ -0,0 +1,13 @@
1
+import * as NodeOS from "node:os";
2
+
3
+// libuv has no name for EDQUOT, so Node reports it as code "UNKNOWN" with the raw errno.
4
+const EDQUOT_ERRNO = NodeOS.constants.errno.EDQUOT;
5
+
6
+// Redirected console output can fail when its log volume is full.
7
+export function handleStdioError(error: unknown): void {
8
+ if (typeof error === "object" && error !== null) {
9
+ if ("code" in error && (error.code === "EPIPE" || error.code === "ENOSPC")) return;
10
+ if (EDQUOT_ERRNO !== undefined && "errno" in error && error.errno === -EDQUOT_ERRNO) return;
11
+ }
12
+ throw error;
13
+}
apps/desktop/src/main.ts
+3
-3
@@ -1,8 +1,8 @@
1
import * as MacPermissions from "./permissions/MacPermissions.ts";
2
+import { handleStdioError } from "./app/stdioErrors.ts";
3
+
4
for (const stream of [process.stdout, process.stderr]) {
3
- stream.on("error", (err: NodeJS.ErrnoException) => {
4
- if (err.code !== "EPIPE") throw err;
5
- });
5
+ stream.on("error", handleStdioError);
6
}
7
8
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";