termstatus: Fix canUpdateStatus detection for redirected output

The canUpdateStatus check was simplified in #2608, but it accidentally flipped
the condition. The correct check is as follows: If the output is a pipe then
restic probably runs in mintty/cygwin. In that case it's possible to
update the output status. In all other cases it isn't.

This commit inverts to condition again to offer the previous and correct
behavior.
This commit is contained in:
Michael Eischer 2020-12-06 16:56:00 +01:00
parent 3264eae9f6
commit b48f579530
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,9 @@
Bugfix: Correctly detect output redirection for `backup` command on Windows
On Windows, since restic 0.10.0 the `backup` command did not properly detect
when the output was redirected to a file. This caused restic to output
terminal control characters. This has been fixed by correcting the terminal
detection.
https://github.com/restic/restic/issues/3111
https://github.com/restic/restic/pull/3150

View File

@ -88,8 +88,8 @@ func canUpdateStatus(fd uintptr) bool {
return true
}
// check if the output file type is a pipe (0x0003)
if isPipe(fd) {
// check that the output file type is a pipe (0x0003)
if !isPipe(fd) {
return false
}