Skip to content

Commit afebdfe

Browse files
fix: remove cmd.exe wrapper in run_binary to fix paths with spaces (#1280)
On Windows, when the executable path contains spaces (e.g. username 'John Doe'), cmd.exe /c strips quotes incorrectly causing the command to fail with 'C:\Users\John' is not recognized as an internal or external command. This fix removes the unnecessary cmd.exe wrapper and calls the executable directly via Command::new(), consistent with the pattern used elsewhere in the codebase (system_ocr.rs, window.rs). The CREATE_NO_WINDOW flag (0x08000000) is already set via creation_flags, so the cmd.exe wrapper was redundant. Closes #1279
1 parent 5b68d0f commit afebdfe

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src-tauri/src/cmd.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,9 @@ pub fn run_binary(
193193
let plugin_path = config_path.join(plugin_name);
194194

195195
#[cfg(target_os = "windows")]
196-
let mut cmd = Command::new("cmd");
196+
let mut cmd = Command::new(&cmd_name);
197197
#[cfg(target_os = "windows")]
198198
let cmd = cmd.creation_flags(0x08000000);
199-
#[cfg(target_os = "windows")]
200-
let cmd = cmd.args(["/c", &cmd_name]);
201199
#[cfg(not(target_os = "windows"))]
202200
let mut cmd = Command::new(&cmd_name);
203201

0 commit comments

Comments
 (0)