fix: Explicitly exit CLI to prevent hanging subprocesses (#3083)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Haris Gušić
2025-10-27 06:03:10 +01:00
committed by GitHub
parent 5e886c35d5
commit a9624c0fff
7 changed files with 71 additions and 51 deletions

View File

@@ -22,8 +22,6 @@ import { AttachCommand } from "./cli/cmd/attach"
import { AcpCommand } from "./cli/cmd/acp"
import { EOL } from "os"
const cancel = new AbortController()
process.on("unhandledRejection", (e) => {
Log.Default.error("rejection", {
e: e instanceof Error ? e.message : e,
@@ -135,6 +133,10 @@ try {
console.error(e)
}
process.exitCode = 1
} finally {
// Some subprocesses don't react properly to SIGTERM and similar signals.
// Most notably, some docker-container-based MCP servers don't handle such signals unless
// run using `docker run --init`.
// Explicitly exit to avoid any hanging subprocesses.
process.exit();
}
cancel.abort()