From 38bf5afaf66a4b42bda23ee794e9c0b2d0129806 Mon Sep 17 00:00:00 2001 From: fengyingcai Date: Mon, 27 Jun 2022 15:27:05 +0800 Subject: [PATCH] chore: fix pisugar-poweroff --- pisugar-core/src/lib.rs | 2 +- pisugar-poweroff/src/main.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pisugar-core/src/lib.rs b/pisugar-core/src/lib.rs index 9ea3d6d..4ec6336 100644 --- a/pisugar-core/src/lib.rs +++ b/pisugar-core/src/lib.rs @@ -636,7 +636,7 @@ impl PiSugarCore { let _ = execute_shell("sync"); } - let _ = call_rtc!(&self.rtc, force_shutdown); + call_rtc!(&self.rtc, force_shutdown)?; call_battery!(&self.battery, shutdown) } diff --git a/pisugar-poweroff/src/main.rs b/pisugar-poweroff/src/main.rs index 884ebb0..45edcea 100644 --- a/pisugar-poweroff/src/main.rs +++ b/pisugar-poweroff/src/main.rs @@ -10,7 +10,9 @@ use std::convert::TryInto; fn shutdown(config: PiSugarConfig, model: Model, retries: u32) -> Result<()> { let core = PiSugarCore::new(config, model)?; for _ in 0..retries { - let _ = core.force_shutdown(); + if let Err(e) = core.force_shutdown() { + eprintln!("{}", e); + } sleep(Duration::from_millis(10)); } Ok(())