Display 'created new cache in ' message only if output is terminal

This commit is contained in:
Hendrik Luup 2021-03-19 13:32:10 +02:00
parent 88a23521dd
commit 5592c17e4a
2 changed files with 10 additions and 1 deletions

View file

@ -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

View file

@ -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)
}