mirror of
https://github.com/FiloSottile/age.git
synced 2026-03-11 08:55:41 +00:00
cmd/age: fallback to stdin if /dev/tty cannot be opened (#414)
This commit is contained in:
parent
e8771b6d8a
commit
ac31f5c935
1 changed files with 1 additions and 5 deletions
|
|
@ -119,11 +119,7 @@ func readPassphrase(prompt string) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
defer out.Close()
|
||||
} else if _, err := os.Stat("/dev/tty"); err == nil {
|
||||
tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0); err == nil {
|
||||
defer tty.Close()
|
||||
in, out = tty, tty
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue