From 54a4034ec0f0f1ea0761c6318be4fe5fa1f1627c Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 23 Oct 2023 21:16:52 +0200 Subject: [PATCH] Only show index progress bar if stdout is a terminal This ensures that there is no interference when using restic for scripting use cases. --- cmd/restic/progress.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/restic/progress.go b/cmd/restic/progress.go index fe4f654d0..8b33f94c9 100644 --- a/cmd/restic/progress.go +++ b/cmd/restic/progress.go @@ -98,9 +98,9 @@ func printProgress(status string) { } func newIndexProgress(quiet bool, json bool) *progress.Counter { - return newProgressMax(!quiet && !json, 0, "index files loaded") + return newProgressMax(!quiet && !json && stdoutIsTerminal(), 0, "index files loaded") } func newIndexTerminalProgress(quiet bool, json bool, term *termstatus.Terminal) *progress.Counter { - return newTerminalProgressMax(!quiet && !json, 0, "index files loaded", term) + return newTerminalProgressMax(!quiet && !json && stdoutIsTerminal(), 0, "index files loaded", term) }