Skip to content

fix: Tauri setup command errors with string escaping on Windows with Bun #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mufaroxyz
Copy link

@mufaroxyz mufaroxyz commented Jun 26, 2025

For some reason, when running the generator with the Tauri setup, bunx encounters an issue with parsing the arg command string (eg. --before-dev-build="bun run dev").

> bun create better-t-stack@latest test-app-1 --frontend svelte --backend hono --runtime bun --database none --orm none --api orpc --no-auth --addons turborepo tauri biome husky --examples none --db-setup none --no-git --package-manager bun --install

◇  Failed to set up Tauri

[02:24:31]  ERROR  Command failed with exit code 2: "bunx @tauri-apps/cli@latest init --app-name=test-app-1 --window-title=test-app-1 --frontend-dist=../build --dev-url=http://localhost:5173 --before-dev-command=""bun run dev"" --before-build-command=""bun run build"""

Resolving dependencies
Resolved, downloaded and extracted [2]
Saved lockfile
error: unexpected argument 'run' found

Usage: bun run bunx init [OPTIONS]

For more information, try '--help'.

This is happening only on Windows (powershell) with Bun. So I added a check in tauri-setup for that specific setup and used direct arguments without shell execution. Not sure if this is something Bun has to fix on their end as pnpm and npm works with no issues. Regardless of that, this PR introduces a workaround to the issue.

Summary by CodeRabbit

  • Refactor
    • Improved setup logic for initializing Tauri CLI, providing better compatibility for Windows users with the "bun" package manager.
    • Enhanced code maintainability by reusing variables and extracting common arguments.

Copy link

changeset-bot bot commented Jun 26, 2025

⚠️ No Changeset found

Latest commit: fad8e89

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 26, 2025

Walkthrough

The setup logic for invoking the Tauri CLI in the project has been refactored to handle a special case: when running on Windows with the "bun" package manager, the command execution method changes from a shell command string to a direct executable with arguments. Common argument construction and variable reuse have been improved.

Changes

File(s) Change Summary
apps/cli/src/helpers/setup/tauri-setup.ts Refactored Tauri CLI invocation logic to handle Windows + bun case with direct executable/args; improved argument reuse and variable assignment.

Poem

A hop and a skip, now Tauri runs,
On Windows with bun, it’s simply fun!
Arguments split, commands anew,
Rabbits code swiftly, as rabbits do.
With clever tweaks and platform care,
The setup’s smoother everywhere! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e29f344 and fad8e89.

📒 Files selected for processing (1)
  • apps/cli/src/helpers/setup/tauri-setup.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/cli/src/helpers/setup/tauri-setup.ts (1)
apps/cli/src/utils/package-runner.ts (1)
  • getPackageExecutionCommand (11-23)
🔇 Additional comments (6)
apps/cli/src/helpers/setup/tauri-setup.ts (6)

66-67: Good platform detection implementation.

The Windows platform detection is correctly implemented and will properly identify the problematic environment.


68-68: Good refactoring to eliminate duplicate calls.

Extracting the app name to a variable eliminates the redundant path.basename(projectDir) calls and improves maintainability.


70-76: Excellent refactoring to reduce code duplication.

The common arguments extraction eliminates duplication between the two execution paths and uses the extracted appName variable consistently.


78-96: Well-implemented workaround for Windows + Bun issue.

The implementation correctly addresses the bunx argument parsing issue by:

  • Splitting the base command into executable and arguments
  • Using direct execa execution without shell interpretation
  • Properly handling argument construction without shell escaping

The approach avoids the problematic shell string parsing that causes bunx to fail on Windows PowerShell.


96-114: Proper preservation of original logic for other cases.

The else branch correctly maintains the original shell execution approach with proper escaping for non-Windows-Bun environments. The difference in quote escaping (with backslashes) is appropriate since this path uses shell execution.


83-83: ```bash
#!/bin/bash
awk '/export function getPackageExecutionCommand/,/^}/' apps/cli/src/utils/package-runner.ts


</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAq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cDyDZVAs4GNEAAG53w8p9FEMOywSUIN+vLEpet4hEC4OLfAFTcDQxLNamptroVIBIMAaitE9DZ38NSVJQldkmVmepeAQTqBpD3Kdc6Bg4oGDqksTJzUMpnHaqAzqfg0A9Wev1eQd4mBKCoJVTQ2gxqGETTldQAB9WiiBq3sJIGUOg1a6TOFCPGxNOJaAAA4SA9oAJwAGYADsAAWNAABWIdtAx0MFiD2gQA6BAAAZB0roXT29Moge2TsnemNAogR0jvLZNKAVbcC1toPWxtzbaDVqSuWoAA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=AmanVarshney01/create-better-t-stack&utm_content=355):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@AmanVarshney01 AmanVarshney01 force-pushed the main branch 2 times, most recently from 6227ae8 to 864e863 Compare July 13, 2025 08:41
@AmanVarshney01 AmanVarshney01 force-pushed the main branch 3 times, most recently from d52a083 to fcbdd0d Compare July 20, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant