mirror of
https://github.com/FiloSottile/age.git
synced 2026-04-27 05:55:05 +00:00
cmd/age: decouple output buffer and output denial decision
Co-authored-by: Filippo Valsorda <hi@filippo.io>
This commit is contained in:
committed by
Filippo Valsorda
parent
6fc795057f
commit
4a5a042583
@@ -182,13 +182,16 @@ func main() {
|
||||
buf := &bytes.Buffer{}
|
||||
defer func() { io.Copy(os.Stdout, buf) }()
|
||||
out = buf
|
||||
} else if decryptFlag && name != "-" {
|
||||
// TODO: buffer the output and check it's printable.
|
||||
} else if name != "-" {
|
||||
// If the output wouldn't be armored, refuse to send binary to the
|
||||
// terminal unless explicitly requested with "-o -".
|
||||
logFatalf("Error: refusing to output binary to the terminal.\n" +
|
||||
`Did you mean to use -a/--armor? Force with "-o -".`)
|
||||
}
|
||||
if name != "-" {
|
||||
if decryptFlag {
|
||||
// TODO: buffer the output and check it's printable.
|
||||
} else if !armorFlag {
|
||||
// If the output wouldn't be armored, refuse to send binary to
|
||||
// the terminal unless explicitly requested with "-o -".
|
||||
logFatalf("Error: refusing to output binary to the terminal.\n" +
|
||||
`Did you mean to use -a/--armor? Force with "-o -".`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user