diff --git a/main.js b/main.js index 76c2c2a..b52b10c 100644 --- a/main.js +++ b/main.js @@ -14,6 +14,14 @@ const { spawn } = require("child_process"); const fs = require("fs"); const WebSocket = require("ws"); +// A browser has no business dying because its stdout went away. Launched from +// a shell — a dev run, a test harness — Theseus inherits that shell's pipe; +// when the shell exits the pipe breaks, and the next console.log raises EPIPE +// in the main process, which Electron reports as a fatal uncaught exception. +// These streams only ever carry diagnostics, and by then nobody is reading +// them, so a write that cannot land is not an error worth stopping for. +for (const stream of [process.stdout, process.stderr]) stream.on("error", () => {}); + // Packaged builds ship the resolver and tor/ as unpacked resources (they can't // run from inside app.asar); dev runs read them from the repo. const RES_DIR = app.isPackaged ? process.resourcesPath : __dirname;