File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ ---
4+
5+ Retain command line arguments in ` api::process::restart ` .
Original file line number Diff line number Diff line change @@ -105,18 +105,22 @@ pub struct Env {
105105 /// The APPDIR environment variable.
106106 #[ cfg( target_os = "linux" ) ]
107107 pub appdir : Option < std:: ffi:: OsString > ,
108+ /// The command line arguments of the current process.
109+ pub args : Vec < String > ,
108110}
109111
110112#[ allow( clippy:: derivable_impls) ]
111113impl Default for Env {
112114 fn default ( ) -> Self {
115+ let args = std:: env:: args ( ) . skip ( 1 ) . collect ( ) ;
113116 #[ cfg( target_os = "linux" ) ]
114117 {
115118 let env = Self {
116119 #[ cfg( target_os = "linux" ) ]
117120 appimage : std:: env:: var_os ( "APPIMAGE" ) ,
118121 #[ cfg( target_os = "linux" ) ]
119122 appdir : std:: env:: var_os ( "APPDIR" ) ,
123+ args,
120124 } ;
121125 if env. appimage . is_some ( ) || env. appdir . is_some ( ) {
122126 // validate that we're actually running on an AppImage
@@ -139,7 +143,7 @@ impl Default for Env {
139143 }
140144 #[ cfg( not( target_os = "linux" ) ) ]
141145 {
142- Self { }
146+ Self { args }
143147 }
144148 }
145149}
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ pub fn restart(env: &Env) {
8383
8484 if let Ok ( path) = current_binary ( env) {
8585 Command :: new ( path)
86+ . args ( & env. args )
8687 . spawn ( )
8788 . expect ( "application failed to start" ) ;
8889 }
You can’t perform that action at this time.
0 commit comments