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.
This commit is contained in:
Mario Zechner 2025-12-10 20:43:28 +01:00
parent 9516424cae
commit 7323af1f69

View file

@ -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);
}
}