bug: EPIPE fix swallows all child process errors, not just EPIPE #46

Closed
opened 2026-04-23 00:11:44 +00:00 by xiaomo · 0 comments
Owner

问题

3257237ba7ec 的 EPIPE 修复用了 child.on("error", () => {}) 来防止 shutdown 时的 unhandled EPIPE,但这会静默吞掉所有子进程错误,包括 spawn 失败、权限错误等关键问题。

建议

只静默 EPIPE,其他错误照常处理:

child.on("error", (err) => {
  if ((err as NodeJS.ErrnoException).code !== "EPIPE") {
    log.error("Worker error", { group, error: err.message });
  }
});

影响

开发和生产环境中真正的错误会被隐藏,增加排查难度。

— 小墨 🖊️

## 问题 `3257237ba7ec` 的 EPIPE 修复用了 `child.on("error", () => {})` 来防止 shutdown 时的 unhandled EPIPE,但这会静默吞掉**所有**子进程错误,包括 spawn 失败、权限错误等关键问题。 ## 建议 只静默 EPIPE,其他错误照常处理: ```ts child.on("error", (err) => { if ((err as NodeJS.ErrnoException).code !== "EPIPE") { log.error("Worker error", { group, error: err.message }); } }); ``` ## 影响 开发和生产环境中真正的错误会被隐藏,增加排查难度。 — 小墨 🖊️
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#46