@@ -71,28 +71,15 @@ pub fn command(options: Options) -> Result<()> {
7171 let r = command_internal ( options) ;
7272 if r. is_err ( ) {
7373 kill_before_dev_process ( ) ;
74+ #[ cfg( not( debug_assertions) ) ]
75+ let _ = check_for_updates ( ) ;
7476 }
7577 r
7678}
7779
7880fn command_internal ( options : Options ) -> Result < ( ) > {
7981 let logger = Logger :: new ( "tauri:dev" ) ;
8082
81- #[ cfg( not( debug_assertions) ) ]
82- match check_for_updates ( ) {
83- Ok ( ( msg, sleep) ) => {
84- if sleep {
85- logger. log ( msg) ;
86- std:: thread:: sleep ( std:: time:: Duration :: from_secs ( 3 ) ) ;
87- } else {
88- logger. log ( msg) ;
89- }
90- }
91- Err ( e) => {
92- logger. log ( e. to_string ( ) ) ;
93- }
94- } ;
95-
9683 let tauri_path = tauri_dir ( ) ;
9784 set_current_dir ( & tauri_path) . with_context ( || "failed to change current working directory" ) ?;
9885 let merge_config = if let Some ( config) = & options. config {
@@ -160,6 +147,8 @@ fn command_internal(options: Options) -> Result<()> {
160147
161148 let _ = ctrlc:: set_handler ( move || {
162149 kill_before_dev_process ( ) ;
150+ #[ cfg( not( debug_assertions) ) ]
151+ let _ = check_for_updates ( ) ;
163152 exit ( 130 ) ;
164153 } ) ;
165154 }
@@ -297,20 +286,21 @@ fn command_internal(options: Options) -> Result<()> {
297286}
298287
299288#[ cfg( not( debug_assertions) ) ]
300- fn check_for_updates ( ) -> Result < ( String , bool ) > {
301- let current_version = crate :: info:: cli_current_version ( ) ?;
302- let current = semver:: Version :: parse ( & current_version) ?;
303-
304- let upstream_version = crate :: info:: cli_upstream_version ( ) ?;
305- let upstream = semver:: Version :: parse ( & upstream_version) ?;
306- if upstream. gt ( & current) {
307- let message = format ! (
308- "🚀 A new version of Tauri CLI is avaliable! [{}]" ,
309- upstream. to_string( )
310- ) ;
311- return Ok ( ( message, true ) ) ;
289+ fn check_for_updates ( ) -> Result < ( ) > {
290+ if std:: env:: var_os ( "TAURI_SKIP_UPDATE_CHECK" ) != Some ( "true" . into ( ) ) {
291+ let current_version = crate :: info:: cli_current_version ( ) ?;
292+ let current = semver:: Version :: parse ( & current_version) ?;
293+
294+ let upstream_version = crate :: info:: cli_upstream_version ( ) ?;
295+ let upstream = semver:: Version :: parse ( & upstream_version) ?;
296+ if current < upstream {
297+ println ! (
298+ "🚀 A new version of Tauri CLI is avaliable! [{}]" ,
299+ upstream. to_string( )
300+ ) ;
301+ } ;
312302 }
313- Ok ( ( "🎉 Tauri CLI is up-to-date!" . into ( ) , false ) )
303+ Ok ( ( ) )
314304}
315305
316306fn lookup < F : FnMut ( FileType , PathBuf ) > ( dir : & Path , mut f : F ) {
@@ -534,6 +524,8 @@ fn start_app(
534524 if exit_on_panic {
535525 if !manually_killed_app. load ( Ordering :: Relaxed ) {
536526 kill_before_dev_process ( ) ;
527+ #[ cfg( not( debug_assertions) ) ]
528+ let _ = check_for_updates ( ) ;
537529 exit ( status. code ( ) . unwrap_or ( 0 ) ) ;
538530 }
539531 } else {
@@ -551,6 +543,8 @@ fn start_app(
551543 // - and error is not a cargo compilation error (using stderr heuristics)
552544 if status. success ( ) || ( status. code ( ) == Some ( 101 ) && !is_cargo_compile_error) {
553545 kill_before_dev_process ( ) ;
546+ #[ cfg( not( debug_assertions) ) ]
547+ let _ = check_for_updates ( ) ;
554548 exit ( status. code ( ) . unwrap_or ( 1 ) ) ;
555549 }
556550 }
0 commit comments