From 2c49900c6a01d00fc46b7b0a37a6742ad9bd27d3 Mon Sep 17 00:00:00 2001 From: Wuji Chen Date: Thu, 23 Apr 2026 02:19:40 +0800 Subject: [PATCH] terminal: Fix heredoc commands failing in agent shell (#49106) Release Notes: - Fixed heredoc commands failing with "syntax error: unexpected end of file" in AI Agent shell execution Co-authored-by: Claude Co-authored-by: Jakub Konka --- crates/util/src/shell_builder.rs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/crates/util/src/shell_builder.rs b/crates/util/src/shell_builder.rs index 86a588d44afa3bf4841a83f2700bd371dce4bd42..58857ab2f619bbc957db5e00cd4ba04c87f5ea3a 100644 --- a/crates/util/src/shell_builder.rs +++ b/crates/util/src/shell_builder.rs @@ -111,7 +111,7 @@ impl ShellBuilder { | ShellKind::Xonsh | ShellKind::Elvish => { combined_command.insert(0, '('); - combined_command.push_str(") { combined_command.insert_str(0, "$null | & {"); @@ -157,7 +157,7 @@ impl ShellBuilder { | ShellKind::Xonsh | ShellKind::Elvish => { combined_command.insert(0, '('); - combined_command.push_str(") { combined_command.insert_str(0, "$null | & {"); @@ -273,7 +273,7 @@ mod test { .build(Some("echo".into()), &["nothing".to_string()]); assert_eq!(program, "nu"); - assert_eq!(args, vec!["-i", "-c", "(echo nothing)