@@ -3,24 +3,20 @@ use self_update::update::Release;
33use semver:: Version ;
44use std:: fs:: File ;
55use std:: path:: Path ;
6- use std:: process:: { Command , ExitStatus } ;
6+ use std:: process:: Command ;
77use std:: { env, fs, io} ;
88use zip:: ZipArchive ;
99
1010const REPO_OWNER : & str = "hacknus" ;
1111const REPO_NAME : & str = "serial-monitor-rust" ;
12-
1312const MACOS_APP_NAME : & str = "Serial Monitor.app" ;
1413
15- pub fn restart_application ( ) -> std :: io :: Result < ExitStatus > {
14+ pub fn restart_application ( ) {
1615 // Get the current executable path
1716 let current_exe = std:: env:: current_exe ( ) . expect ( "Failed to get current executable path" ) ;
1817
1918 // Launch a new instance of the application
20- Command :: new ( current_exe)
21- . spawn ( )
22- . expect ( "Failed to restart application" )
23- . wait ( )
19+ let _ = Command :: new ( current_exe) . spawn ( ) ;
2420}
2521
2622fn extract_zip ( tmp_archive_path : & Path , tmp_archive_dir : & Path ) -> io:: Result < ( ) > {
@@ -173,6 +169,10 @@ pub fn update(release: Release) -> Result<(), Box<dyn std::error::Error>> {
173169
174170 let _ = copy_dir ( & tmp_archive_dir. path ( ) . join ( & app_name) , & app_dir, & binary) ;
175171
172+ // MACOS_APP_NAME either needs to be hardcoded or extracted from the downloaded and
173+ // extracted archive, but we cannot just assume that the parent directory of the
174+ // currently running executable is equal to the app name - this is especially not
175+ // the case if we run the code with `cargo run`.
176176 tmp_archive_dir
177177 . path ( )
178178 . join ( format ! ( "{}/Contents/MacOS/{}" , MACOS_APP_NAME , binary) )
0 commit comments