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

refactor(core)!: include all args in Env.args_os, closes #9430 #9552

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/core-env-args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri": "patch:breaking"
---

Include binary path in `Env.args_os`, previously it was skipped.

2 changes: 1 addition & 1 deletion core/tauri-build/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
if deps.is_empty() {
if let Some(alias) = &metadata.alias {
deps = find_dependency(manifest, alias, metadata.kind);
name.clone_from(alias)
name.clone_from(alias);
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/tauri-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ pub struct Env {
#[allow(clippy::derivable_impls)]
impl Default for Env {
fn default() -> Self {
let args_os = std::env::args_os().skip(1).collect();
let args_os = std::env::args_os().collect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change impacts the restart command, it should skip the first arg in there (we should also check if this doesn't impact the plugins)

#[cfg(target_os = "linux")]
{
let env = Self {
Expand Down
3 changes: 2 additions & 1 deletion core/tauri/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ pub fn restart(env: &Env) {

if let Ok(path) = current_binary(env) {
Command::new(path)
.args(&env.args_os)
// first arg is the binary name, must skip it
.args(env.args_os.iter().skip(1).collect::<Vec<_>>())
.spawn()
.expect("application failed to start");
}
Expand Down