Skip to content

Commit 51aa203

Browse files
fix(cli): run package managers directly on Windows instead of through cmd /c (#16119)
* fix(cli): run package managers directly on Windows instead of through cmd /c * Apply suggestion from @Legend-Master --------- Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
1 parent 1aafaa4 commit 51aa203

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:sec
3+
"@tauri-apps/cli": patch:sec
4+
---
5+
6+
On Windows, package manager commands (`npm`, `pnpm`, `yarn`, `bun`, `deno`, `node`) are now executed directly instead of through `cmd /c`, so arguments such as `@tauri-apps/plugin-fs@>=2` are escaped properly and can no longer be interpreted as shell redirections or command separators.

‎crates/tauri-cli/src/helpers/mod.rs‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ pub fn resolve_tauri_path<P: AsRef<Path>>(path: P, crate_name: &str) -> PathBuf
5757
}
5858

5959
pub fn cross_command(bin: &str) -> Command {
60+
// Resolve the actual executable (e.g. `npm.cmd`, `bun.exe`)
6061
#[cfg(target_os = "windows")]
61-
let cmd = {
62-
let mut cmd = Command::new("cmd");
63-
cmd.arg("/c").arg(bin);
64-
cmd
65-
};
62+
let cmd = Command::new(which::which(bin).unwrap_or_else(|_| bin.into()));
6663
#[cfg(not(target_os = "windows"))]
6764
let cmd = Command::new(bin);
6865
cmd

0 commit comments

Comments
 (0)