From 16f92ff011791eab072a8f87d3062f9b3f6b28c2 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 1 Dec 2025 15:03:35 +0100 Subject: [PATCH] fix(cli-repl): clear window title when mongosh exits MONGOSH-1233 Terminals do not provide an easy way to "push/pop" window titles, so we're basically stuck with clearing the window title when mongosh exits on a best-effort basis. When somebody brings this up as an issue, we should still recommend them to include something in their shell's .rc file to automatically reset window titles after each shell command. --- packages/cli-repl/src/run.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/cli-repl/src/run.ts b/packages/cli-repl/src/run.ts index 612bf42ee..c4fb29006 100644 --- a/packages/cli-repl/src/run.ts +++ b/packages/cli-repl/src/run.ts @@ -346,6 +346,8 @@ function suppressExperimentalWarnings() { } function onExit(code?: number): never { + setTerminalWindowTitle(''); // Clear the terminal window title MONGOSH-1233 + // Node.js 20.0.0 made p.exit(undefined) behave as p.exit(0) rather than p.exit(): (code?: number | undefined): never => { try { try {