From aa82756e8ebbcb2416ae5b850a036996a94e90a3 Mon Sep 17 00:00:00 2001 From: Yuhang Wei Date: Thu, 26 Dec 2024 10:24:35 +0800 Subject: [PATCH] fix(agent): ensure stdout is flushed before rebooting Signed-off-by: Yuhang Wei --- KubeOS-Rust/agent/src/rpc/agent_impl.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KubeOS-Rust/agent/src/rpc/agent_impl.rs b/KubeOS-Rust/agent/src/rpc/agent_impl.rs index 1241d492..7df8586c 100644 --- a/KubeOS-Rust/agent/src/rpc/agent_impl.rs +++ b/KubeOS-Rust/agent/src/rpc/agent_impl.rs @@ -10,7 +10,7 @@ * See the Mulan PSL v2 for more details. */ -use std::{sync::Mutex, thread, time::Duration}; +use std::{io::Write, sync::Mutex, thread, time::Duration}; use anyhow::{bail, Result}; use log::{debug, info}; @@ -154,7 +154,7 @@ impl AgentImpl { fn reboot(&self) -> Result<()> { info!("Wait to reboot"); - std::io::stdout().flush(); + std::io::stdout().flush()?; thread::sleep(Duration::from_secs(1)); sync(); if self.disable_reboot { -- Gitee