Skip to content

Commit bcf000c

Browse files
authored
fix(cli): ios command failing when running with deno, closes #13547 (#14110)
Deno doesn't set an environment variable to help us, so I had to use the exe path to determine whether we're running under deno or not
1 parent 61b9b68 commit bcf000c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.changes/fix-deno-cli-ios.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Fixes running `ios` commands with `deno` crashing due to incorrect current working directory resolution.

crates/tauri-cli/src/mobile/ios/xcode_script.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ pub fn command(options: Options) -> Result<()> {
6565
}
6666
}
6767

68-
// `xcode-script` is ran from the `gen/apple` folder when not using NPM/yarn/pnpm.
68+
let process_path = std::env::current_exe().unwrap_or_default();
69+
70+
// `xcode-script` is ran from the `gen/apple` folder when not using NPM/yarn/pnpm/deno.
6971
// so we must change working directory to the src-tauri folder to resolve the tauri dir
7072
// additionally, bun@<1.2 does not modify the current working directory, so it is also runs this script from `gen/apple`
7173
// bun@>1.2 now actually moves the CWD to the package root so we shouldn't modify CWD in that case
7274
// see https://bun.sh/blog/bun-v1.2#bun-run-uses-the-correct-directory
73-
if (var_os("npm_lifecycle_event").is_none() && var_os("PNPM_PACKAGE_NAME").is_none())
75+
if (var_os("npm_lifecycle_event").is_none()
76+
&& var_os("PNPM_PACKAGE_NAME").is_none()
77+
&& process_path.file_stem().unwrap_or_default() != "deno")
7478
|| var("npm_config_user_agent")
7579
.is_ok_and(|agent| agent.starts_with("bun/1.0") || agent.starts_with("bun/1.1"))
7680
{

0 commit comments

Comments
 (0)