From b6543c0c4710c70afa2a707d23b5513127af320f Mon Sep 17 00:00:00 2001 From: sdairs Date: Tue, 16 Jun 2026 11:00:11 +0100 Subject: [PATCH] Flush stdout before slow stop in stop-all (fixes #256) The local/global `stop-all` handlers printed the in-progress "Stopping ''..." message with `print!` (no newline) and then ran the graceful kill, which sleeps up to ~2.6s per server. With no newline, line-buffered stdout held the text until the trailing `println!(" stopped")` ran after the delay, so the whole line landed at once and looked frozen. Flush stdout immediately after the `print!` so the prompt is visible before the kill runs; " stopped" is then appended to the same line. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/clickhousectl/src/local/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/clickhousectl/src/local/mod.rs b/crates/clickhousectl/src/local/mod.rs index e94cdc5..910969b 100644 --- a/crates/clickhousectl/src/local/mod.rs +++ b/crates/clickhousectl/src/local/mod.rs @@ -11,6 +11,7 @@ use cli::{LocalCommands, ServerCommands}; use crate::error::{Error, Result}; use crate::{init, paths, version_manager}; +use std::io::Write; use std::os::unix::process::CommandExt; use std::process::Command; @@ -820,6 +821,7 @@ fn stop_all_servers_local(json: bool) -> Result<()> { for s in &servers { if !json { print!("Stopping '{}'...", s.name); + let _ = std::io::stdout().flush(); } match server::kill_server(&s.name) { Ok(()) => { @@ -863,6 +865,7 @@ fn stop_all_servers_global(json: bool) -> Result<()> { for s in &servers { if !json { print!("Stopping '{}' ({})...", s.name, s.project); + let _ = std::io::stdout().flush(); } match server::kill_server_by_pid(s.pid) { Ok(()) => {