diff --git a/cmd/age/age.go b/cmd/age/age.go index cf9593d0..1577cc79 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -176,13 +176,6 @@ func main() { defer f.Close() out = f } else if terminal.IsTerminal(int(os.Stdout.Fd())) { - if armorFlag { - // If the output will go to a TTY, and it will be armored, buffer it - // up so it doesn't get in the way of typing the input. - buf := &bytes.Buffer{} - defer func() { io.Copy(os.Stdout, buf) }() - out = buf - } if name != "-" { if decryptFlag { // TODO: buffer the output and check it's printable. @@ -193,6 +186,13 @@ func main() { `Did you mean to use -a/--armor? Force with "-o -".`) } } + if in == os.Stdin && terminal.IsTerminal(int(os.Stdin.Fd())) { + // If the input comes from a TTY and output will go to a TTY, + // buffer it up so it doesn't get in the way of typing the input. + buf := &bytes.Buffer{} + defer func() { io.Copy(os.Stdout, buf) }() + out = buf + } } switch {