File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -755,6 +755,7 @@ pub async fn main() -> Result<()> {
755
755
// spawn a task to watch for ctrl-c signals from user to trigger the shutdown
756
756
spawn_in_span ( shutdown. on_user_signal ( "User signaled shutdown" . to_string ( ) ) ) ;
757
757
758
+ let current_exe = std:: env:: current_exe ( ) ?;
758
759
let restart = Arc :: new ( Mutex :: new ( false ) ) ;
759
760
if let Err ( error) = run (
760
761
cfg,
@@ -774,8 +775,8 @@ pub async fn main() -> Result<()> {
774
775
let reason = shutdown. completed_shutdown ( ) . await ;
775
776
776
777
if * restart. lock ( ) . await {
777
- info ! ( "Restarting Light Client..." ) ;
778
- utils:: restart ( ) ;
778
+ info ! ( "Restarting light client at {}" , current_exe . display ( ) ) ;
779
+ utils:: restart ( current_exe ) ;
779
780
}
780
781
781
782
// we are not logging error here since expectation is
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ pub async fn run(
223
223
continue ;
224
224
}
225
225
if started_at. elapsed ( ) >= delay {
226
- info ! ( "Updating the Avail Light Client ..." ) ;
226
+ info ! ( "Updating light client ..." ) ;
227
227
228
228
let asset = release. target_asset ( ) ?;
229
229
@@ -254,24 +254,24 @@ pub async fn run(
254
254
} )
255
255
. await ?;
256
256
257
- info ! ( "Downloaded new version of the Avail Light Client" ) ;
257
+ info ! ( "Downloaded new version from {}" , asset . url ) ;
258
258
259
259
let asset_name = asset. target . bin_name ( ) ;
260
260
261
261
// extract to current directory
262
262
extract_archive ( & archive_path, asset_name) ?;
263
263
264
- debug ! ( "Extracted new version of the Avail Light Client: {asset_name}" ) ;
264
+ info ! ( "Extracted new version of {asset_name}" ) ;
265
265
266
266
let bin = current_dir. as_path ( ) . join ( PathBuf :: from ( asset_name) ) ;
267
267
self_replace:: self_replace ( bin) ?;
268
268
269
- debug ! ( "Replaced new version of the Avail Light Client " ) ;
269
+ info ! ( "Replaced new version of the light client " ) ;
270
270
271
271
let mut restart = restart. lock ( ) . await ;
272
272
* restart = true ;
273
273
274
- let message = "Avail Light Client update is available , stopping..." . to_string ( ) ;
274
+ let message = "Light client updated , stopping..." . to_string ( ) ;
275
275
if let Err ( error) = shutdown. trigger_shutdown ( message) {
276
276
error ! ( "{error:#}" ) ;
277
277
}
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ use color_eyre::{
18
18
Result ,
19
19
} ;
20
20
use futures:: Future ;
21
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
22
+ use std:: path:: PathBuf ;
21
23
use tokio:: task:: JoinHandle ;
22
24
#[ cfg( target_arch = "wasm32" ) ]
23
25
use tokio_with_wasm:: alias as tokio;
@@ -204,15 +206,15 @@ pub fn rng() -> rand::rngs::StdRng {
204
206
}
205
207
206
208
#[ cfg( not( target_arch = "wasm32" ) ) ]
207
- pub fn restart ( ) {
208
- let current_exe = std:: env:: current_exe ( ) . unwrap ( ) ;
209
-
209
+ pub fn restart ( current_exe : PathBuf ) {
210
210
#[ cfg( unix) ]
211
211
{
212
212
use std:: os:: unix:: process:: CommandExt ;
213
- _ = std:: process:: Command :: new ( current_exe)
213
+ let error = std:: process:: Command :: new ( current_exe)
214
214
. args ( std:: env:: args ( ) . skip ( 1 ) )
215
215
. exec ( ) ;
216
+ error ! ( "Restarting light client failed: {error}" ) ;
217
+ std:: process:: exit ( 1 ) ;
216
218
}
217
219
218
220
#[ cfg( windows) ]
You can’t perform that action at this time.
0 commit comments