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

Release Notes:

- N/A
This commit is contained in:
THELOSTSOUL 2025-05-12 23:02:33 +08:00 committed by GitHub
parent e79d1b27b1
commit 93b6fdb8e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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| {