Skip to content

Commit

Permalink
refactor(core)!: include all args in Env.args_os, closes tauri-apps…
Browse files Browse the repository at this point in the history
…#9430 (tauri-apps#9552)

* refactor(core)!: include all args in `Env.args_os`, closes tauri-apps#9430

* skip first arg on restart fn

---------

Co-authored-by: Lucas Nogueira <[email protected]>
  • Loading branch information
amrbashir and lucasfernog committed May 28, 2024
1 parent 19b696b commit e8f6eb5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
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();
#[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

0 comments on commit e8f6eb5

Please sign in to comment.