From 0281bedad7eae959c25cd5e8ebc6021221096bb1 Mon Sep 17 00:00:00 2001 From: Alexander 'ccntrq' Pankoff Date: Tue, 17 Jun 2025 21:21:09 +0200 Subject: [PATCH] fix: ensure consistent bash command output across terminal environments The output from `spawn_bash` was inconsistent depending on the terminal environment where the process was spawned. In tmux and other advanced terminals, the output included ANSI control sequences for features like bracketed paste mode, causing test failures and unreliable behavior. Set TERM="" when spawning bash to force a dumb terminal mode, ensuring clean, consistent output regardless of the parent terminal environment. Example error: ``` thread 'session::tests::test_bash' panicked at src/session.rs:542:9: assertion `left == right` failed left: "/tmp\r\n" right: "\u{1b}[?2004l\r\r\n/tmp\r\n\u{1b}[?2004h" ``` --- src/session.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/session.rs b/src/session.rs index 35ab8473..52f2f41b 100644 --- a/src/session.rs +++ b/src/session.rs @@ -397,6 +397,7 @@ pub fn spawn_bash(timeout: Option) -> Result { unset PROMPT_COMMAND\n", )?; let mut c = Command::new("bash"); + c.env("TERM", ""); c.args([ "--rcfile", rcfile.path().to_str().unwrap_or("temp file does not exist"),