Skip to content

Conversation

@AlexanderYastrebov
Copy link
Contributor

Read passphrase from stdin when it is not used for input data.

Fixes #603

Read passphrase from stdin when it is not used for input data.

Fixes FiloSottile#603
if in != os.Stdin && !term.IsTerminal(int(os.Stdin.Fd())) {
passphrase = func() (string, error) {
b, err := io.ReadAll(os.Stdin)
b = bytes.TrimRight(b, "\n")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trimming newline to make test case work and improve usability when passphrase is coming from a file or via echo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't pass password via stdin during decrypt

1 participant