@@ -2,7 +2,7 @@ use crate::entries::BootableEntry;
22use crate :: integrations:: bootloader_interface:: BootloaderInterface ;
33use crate :: platform:: timer:: PlatformTimer ;
44use anyhow:: { Context , Result , bail} ;
5- use log:: info;
5+ use log:: { info, warn } ;
66use std:: time:: Duration ;
77use uefi:: ResultExt ;
88use uefi:: boot:: TimerTrigger ;
@@ -66,7 +66,20 @@ fn read(input: &mut Input, timeout: &Duration) -> Result<MenuOperation> {
6666 // Close the timer event that we acquired.
6767 // We don't need to close the key event because it is owned globally.
6868 if let Some ( timer_event) = events. into_iter ( ) . next ( ) {
69- uefi:: boot:: close_event ( timer_event) . context ( "unable to close timer event" ) ?;
69+ // Store the result of the close event so we can determine if we can safely assert it.
70+ let close_event_result =
71+ uefi:: boot:: close_event ( timer_event) . context ( "unable to close timer event" ) ;
72+ if event_result. is_err ( )
73+ && let Err ( ref close_event_error) = close_event_result
74+ {
75+ // Log a warning if we failed to close the timer event.
76+ // This is done to ensure we don't mask the wait_for_event error.
77+ warn ! ( "unable to close timer event: {}" , close_event_error) ;
78+ } else {
79+ // If we reach here, we can safely assert that the close event succeeded without
80+ // masking the wait_for_event error.
81+ close_event_result?;
82+ }
7083 }
7184
7285 // Acquire the event that triggered.
0 commit comments