Skip to content

Commit 1f123bf

Browse files
thlstsulosiewicz
authored andcommitted
assistant_tools: Make terminal tool work on Windows (#30497)
Release Notes: - N/A
1 parent ca1b9b1 commit 1f123bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/assistant_tools/src/terminal_tool.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ impl Tool for TerminalTool {
131131
Err(err) => return Task::ready(Err(err)).into(),
132132
};
133133
let program = self.determine_shell.clone();
134-
let command = format!("({}) </dev/null", input.command);
135-
let args = vec!["-c".into(), command.clone()];
134+
let command = if cfg!(windows) {
135+
format!("$null | & {{{}}}", input.command.replace("\"", "'"))
136+
} else {
137+
format!("({}) </dev/null", input.command)
138+
};
139+
let args = vec!["-c".into(), command];
136140
let cwd = working_dir.clone();
137141
let env = match &working_dir {
138142
Some(dir) => project.update(cx, |project, cx| {

0 commit comments

Comments
 (0)