From 7323af1f697c773edd22cb0814fe03ebc75369c6 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 10 Dec 2025 20:43:28 +0100 Subject: [PATCH] fixes #161: stop theme watcher and exit cleanly in print mode The theme file watcher was keeping the Node.js process alive indefinitely even in print mode where hot-reload is unnecessary. This simple fix calls stopThemeWatcher() and process.exit(0) after print mode completes. - Added stopThemeWatcher() call after runPrintMode() completes - Added process.exit(0) to ensure clean process termination - Imported stopThemeWatcher from theme module This is a minimal fix that addresses the symptom (process hanging) without changing the theme initialization logic. --- packages/coding-agent/src/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index 6e06cb25..eb40896e 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -20,7 +20,7 @@ import { loadSlashCommands } from "./core/slash-commands.js"; import { buildSystemPrompt } from "./core/system-prompt.js"; import { allTools, codingTools } from "./core/tools/index.js"; import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index.js"; -import { initTheme } from "./modes/interactive/theme/theme.js"; +import { initTheme, stopThemeWatcher } from "./modes/interactive/theme/theme.js"; import { getChangelogPath, getNewEntries, parseChangelog } from "./utils/changelog.js"; import { ensureTool } from "./utils/tools-manager.js"; @@ -394,6 +394,9 @@ export async function main(args: string[]) { } else { // Non-interactive mode (--print flag or --mode flag) await runPrintMode(session, mode, parsed.messages, initialMessage, initialAttachments); + // Clean up and exit (file watchers keep process alive) + stopThemeWatcher(); + process.exit(0); } }