From 5592c17e4a661d49b10eb4e1ad89d31e23443862 Mon Sep 17 00:00:00 2001 From: Hendrik Luup Date: Fri, 19 Mar 2021 13:32:10 +0200 Subject: [PATCH] Display 'created new cache in ' message only if output is terminal --- changelog/unreleased/issue-3334 | 9 +++++++++ cmd/restic/global.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/issue-3334 diff --git a/changelog/unreleased/issue-3334 b/changelog/unreleased/issue-3334 new file mode 100644 index 000000000..b8a4e05f5 --- /dev/null +++ b/changelog/unreleased/issue-3334 @@ -0,0 +1,9 @@ +Bugfix: Print `created new cache` message only on a terminal + +`created new cache` message was outputed even when the output wasn't a +terminal. That broke piping `restic dump` output to tar or zip +if cache directory didn't exist. The message is now only printed on a +terminal. + +https://github.com/restic/restic/issues/3334 +https://github.com/restic/restic/pull/3343 diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 7f195d97b..f5255e22b 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -492,7 +492,7 @@ func OpenRepository(opts GlobalOptions) (*repository.Repository, error) { return s, nil } - if c.Created && !opts.JSON { + if c.Created && !opts.JSON && stdoutIsTerminal() { Verbosef("created new cache in %v\n", c.Base) }