From 0759c301e7e4439bd1a02e0404fcbff4cb2eb203 Mon Sep 17 00:00:00 2001 From: sumit-m <33051892+sumit-m@users.noreply.github.com> Date: Thu, 30 Jul 2026 18:27:54 +0530 Subject: [PATCH] test(buzz-acp): quote the steer capture path for bash The capture path was interpolated unquoted into a bash -c script, so on Windows bash ate the backslashes as escapes: the redirect wrote a mangled relative file into the crate directory and both steer tests failed on the missing capture. Render with forward slashes and quote the redirect target. Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com> --- crates/buzz-acp/src/acp.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/buzz-acp/src/acp.rs b/crates/buzz-acp/src/acp.rs index 93109fa94d..168719efd3 100644 --- a/crates/buzz-acp/src/acp.rs +++ b/crates/buzz-acp/src/acp.rs @@ -3906,14 +3906,25 @@ mod tests { /// /// The steer request is the first thing this read loop writes, so the /// captured line IS the steer request bytes. + /// Render a path for interpolation into a `bash -c` script. + /// + /// A Windows path must not reach bash with its backslashes intact: unquoted, + /// bash consumes them as escapes, so `C:\Users\x\Temp\cap.json` collapses to + /// the relative `C:UsersxTempcap.json` and the redirect lands a junk file in + /// the working directory instead. Forward slashes are accepted by the MSYS + /// bash used on Windows, and the quotes the caller adds cover spaces. + fn bash_path(path: &std::path::Path) -> String { + path.display().to_string().replace('\\', "/") + } + async fn spawn_steer_capture_script( capture_path: &std::path::Path, response: &str, ) -> AcpClient { let script = format!( - "read -r line; printf '%s' \"$line\" > {capture}; \ + "read -r line; printf '%s' \"$line\" > \"{capture}\"; \ printf '%s\\n' '{response}'; sleep 10", - capture = capture_path.display(), + capture = bash_path(capture_path), response = response, ); spawn_script(&script).await