Skip to content
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

[bug] tauri-cli incorrectly parses application arguments #5415

Closed
fpgaminer opened this issue Oct 16, 2022 · 3 comments
Closed

[bug] tauri-cli incorrectly parses application arguments #5415

fpgaminer opened this issue Oct 16, 2022 · 3 comments
Labels
scope: cli.rs The tauri-cli rust crate status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@fpgaminer
Copy link

Describe the bug

Running cargo tauri dev -- -- --myoption causes tauri to pass --no-default-features to my application. That means cargo build doesn't get that flag, and it means my application crashes because clap isn't expecting the --no-default-features flag in my application.

This seems to be due to this code:

options.args.push("--no-default-features".into());

After that line the rest of the function splits up args into args and run_args by looking for --. Since --no-default-features is pushed onto args beforehand, it will incorrectly end up in run_args.

Likely the code that pushes --no-default-features should either use an insert to put the flag at the beginning of args, or the push needs to occur after run_args has been split off.

Reproduction

No response

Expected behavior

No response

Platform and versions

Environment
  › OS: Mac OS 12.6.0 X64
  › Node.js: 18.10.0
  › npm: 8.19.2
  › pnpm: Not installed!
  › yarn: Not installed!
  › rustup: 1.25.1
  › rustc: 1.64.0
  › cargo: 1.64.0
  › Rust toolchain: stable-aarch64-apple-darwin 

Packages
  › @tauri-apps/cli [NPM]: 1.1.1
  › @tauri-apps/api [NPM]: 1.1.0
  › tauri [RUST]: 1.1.1,
  › tauri-build [RUST]: 1.1.1,
  › tao [RUST]: 0.14.0,
  › wry [RUST]: 0.21.1,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:1420/
  › framework: React

App directory structure
  ├─ dist
  ├─ node_modules
  ├─ public
  ├─ src-tauri
  ├─ .vscode
  └─ src

Stack trace

No response

Additional context

No response

@fpgaminer fpgaminer added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 16, 2022
@amrbashir amrbashir added the scope: cli.rs The tauri-cli rust crate label Oct 18, 2022
@e792a8
Copy link

e792a8 commented Feb 6, 2023

This bug also causes the app ui not updating when frontend file changes. Cargo do not receive '--no-default-features', so the app is not connecting to frontend dev server but using old dist files.

@FabianLars
Copy link
Member

@e792a8 This issue was fixed in the cli v1.2.0. Can you make sure your dependencies are up to date?

Also you can remove the default-features from the Cargo.toml file without any consequences (starting with v1.3 it won't be part of the templates anymore).

@e792a8
Copy link

e792a8 commented Feb 6, 2023

@FabianLars I know... I have just encountered these problems, then I'm here to find it already fixed. Updating to cli v1.2 solved these. Thank u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: cli.rs The tauri-cli rust crate status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

4 participants