Skip to content

Commit e8f6eb5

Browse files
refactor(core)!: include all args in Env.args_os, closes #9430 (#9552)
* refactor(core)!: include all args in `Env.args_os`, closes #9430 * skip first arg on restart fn --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
1 parent 19b696b commit e8f6eb5

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.changes/core-env-args.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": "patch:breaking"
3+
---
4+
5+
Include binary path in `Env.args_os`, previously it was skipped.
6+

core/tauri-build/src/manifest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
6565
if deps.is_empty() {
6666
if let Some(alias) = &metadata.alias {
6767
deps = find_dependency(manifest, alias, metadata.kind);
68-
name.clone_from(alias)
68+
name.clone_from(alias);
6969
}
7070
}
7171

core/tauri-utils/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ pub struct Env {
295295
#[allow(clippy::derivable_impls)]
296296
impl Default for Env {
297297
fn default() -> Self {
298-
let args_os = std::env::args_os().skip(1).collect();
298+
let args_os = std::env::args_os().collect();
299299
#[cfg(target_os = "linux")]
300300
{
301301
let env = Self {

core/tauri/src/process.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ pub fn restart(env: &Env) {
7676

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

0 commit comments

Comments
 (0)