Skip to content

Commit 3577bf2

Browse files
committed
fix: Explicitly exit process to prevent hanging subprocesses
1 parent 47dfebf commit 3577bf2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/opencode/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ try {
129129
if (formatted) UI.error(formatted)
130130
if (formatted === undefined) UI.error("Unexpected error, check log file at " + Log.file() + " for more details")
131131
process.exitCode = 1
132+
} finally {
133+
// Some subprocesses don't react properly to SIGTERM and similar signals.
134+
// Most notably, some docker-container-based MCP servers don't handle such signals unless
135+
// run using `docker run --init`.
136+
// Explicitly exit to avoid any hanging subprocesses.
137+
process.exit();
132138
}
133139

134140
cancel.abort()

0 commit comments

Comments
 (0)