Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant_tools: Make terminal tool work on Windows (#30497)

THELOSTSOUL93b6fdb8e5ef
diff --git a/crates/assistant_tools/src/terminal_tool.rs b/crates/assistant_tools/src/terminal_tool.rs
index 5ca65741ace..82c98f44199 100644
--- a/crates/assistant_tools/src/terminal_tool.rs
+++ b/crates/assistant_tools/src/terminal_tool.rs
@@ -131,8 +131,12 @@ impl Tool for TerminalTool {
Err(err) => return Task::ready(Err(err)).into(),
};
let program = self.determine_shell.clone();
- let command = format!("({}) </dev/null", input.command);
- let args = vec!["-c".into(), command.clone()];
+ let command = if cfg!(windows) {
+ format!("$null | & {{{}}}", input.command.replace("\"", "'"))
+ } else {
+ format!("({}) </dev/null", input.command)
+ };
+ let args = vec!["-c".into(), command];
let cwd = working_dir.clone();
let env = match &working_dir {
Some(dir) => project.update(cx, |project, cx| {