@@ -229,6 +229,8 @@ pub enum ActivationConfirmationError {
229
229
CreateConfirmFile ( std:: io:: Error ) ,
230
230
#[ error( "Could not watch for activation sentinel: {0}" ) ]
231
231
Watcher ( #[ from] notify:: Error ) ,
232
+ #[ error( "Error waiting for confirmation event: {0}" ) ]
233
+ WaitingError ( #[ from] DangerZoneError ) ,
232
234
}
233
235
234
236
#[ derive( Error , Debug ) ]
@@ -256,7 +258,6 @@ async fn danger_zone(
256
258
}
257
259
258
260
pub async fn activation_confirmation (
259
- profile_path : String ,
260
261
temp_path : PathBuf ,
261
262
confirm_timeout : u16 ,
262
263
closure : String ,
@@ -302,18 +303,9 @@ pub async fn activation_confirmation(
302
303
303
304
watcher. watch ( & lock_path, RecursiveMode :: NonRecursive ) ?;
304
305
305
- if let Err ( err) = danger_zone ( done, confirm_timeout) . await {
306
- error ! ( "Error waiting for confirmation event: {}" , err) ;
307
-
308
- if let Err ( err) = deactivate ( & profile_path) . await {
309
- error ! (
310
- "Error de-activating due to another error waiting for confirmation, oh no...: {}" ,
311
- err
312
- ) ;
313
- }
314
- }
315
-
316
- Ok ( ( ) )
306
+ danger_zone ( done, confirm_timeout)
307
+ . await
308
+ . map_err ( |err| ActivationConfirmationError :: WaitingError ( err) )
317
309
}
318
310
319
311
#[ derive( Error , Debug ) ]
@@ -463,16 +455,10 @@ pub async fn activate(
463
455
464
456
if magic_rollback && !boot {
465
457
info ! ( "Magic rollback is enabled, setting up confirmation hook..." ) ;
466
-
467
- match activation_confirmation ( profile_path. clone ( ) , temp_path, confirm_timeout, closure)
468
- . await
469
- {
470
- Ok ( ( ) ) => { }
471
- Err ( err) => {
472
- deactivate ( & profile_path) . await ?;
473
- return Err ( ActivateError :: ActivationConfirmation ( err) ) ;
474
- }
475
- } ;
458
+ if let Err ( err) = activation_confirmation ( temp_path, confirm_timeout, closure) . await {
459
+ deactivate ( & profile_path) . await ?;
460
+ return Err ( ActivateError :: ActivationConfirmation ( err) ) ;
461
+ }
476
462
}
477
463
}
478
464
0 commit comments