From d4a21cef590c19b3a63af289124b998502cd664c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 30 Nov 2026 10:39:05 -0800 Subject: [PATCH] weed: flush buffered log lines when a command exits (#13151) exit() ends the process with os.Exit, which skips deferred calls, and glog writes its files only every 30s. A short-lived command such as a piped weed shell session lost every log line it buffered, including the daily_run summary of s3.lifecycle.run-shard. Co-authored-by: Claude Opus 5.5 --- weed/weed.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/weed/weed.go b/weed/weed.go index ff0c2fea50..6b1ae06096 100644 --- a/weed/weed.go +++ b/weed/weed.go @@ -221,7 +221,9 @@ func exit() { for _, f := range atexitFuncs { f() } - // os.Exit below skips main's deferred flush. + // os.Exit below skips main's deferred flush, and glog only flushes its + // files every 30s, so a short command would lose its log lines. + glog.Flush() sentry.Flush(2 * time.Second) os.Exit(exitStatus) }