relay-companion 0.1.73 → 0.1.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/overlay/main.cjs +18 -0
  2. package/package.json +1 -1
package/overlay/main.cjs CHANGED
@@ -21,6 +21,24 @@
21
21
  // auth. ack/mark-read writes state.json directly (atomic temp+rename).
22
22
 
23
23
  const { app, BrowserWindow, Menu, Tray, ipcMain, nativeImage, powerMonitor, shell, screen, systemPreferences } = require("electron");
24
+
25
+ // A closed stdout/stderr pipe must never kill the pill. When whatever launched
26
+ // us goes away (launchd log rotation, a terminal that spawned `relay pill`, a
27
+ // parent harness exiting), the next console write throws EPIPE — and an
28
+ // unhandled throw in the main process shows Electron's "A JavaScript error
29
+ // occurred" dialog and takes the overlay down. Logging is diagnostic; it is
30
+ // never worth a crash, so swallow write errors on both streams and treat a
31
+ // stray EPIPE as a no-op.
32
+ for (const stream of [process.stdout, process.stderr]) {
33
+ try {
34
+ stream.on("error", () => {});
35
+ } catch {}
36
+ }
37
+ process.on("uncaughtException", (error) => {
38
+ if (error && (error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED")) return;
39
+ throw error;
40
+ });
41
+
24
42
  const fs = require("node:fs");
25
43
  const os = require("node:os");
26
44
  const path = require("node:path");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relay-companion",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
4
4
  "description": "Relay companion for ordinary messages, with dormant coordination features available only by explicit opt-in.",
5
5
  "type": "module",
6
6
  "bin": {