Skip to content

Commit 1d3eefa

Browse files
committed
fix review comments
Signed-off-by: Tomasz Duda <tomaszduda23@gmail.com>
1 parent 0ba8bd1 commit 1d3eefa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

age/tui.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"fmt"
1515
"os"
1616
"runtime"
17+
"testing"
1718

1819
"golang.org/x/term"
1920
)
@@ -25,9 +26,11 @@ const (
2526
// readPassphrase reads a passphrase from the terminal. It does not read from a
2627
// non-terminal stdin, so it does not check stdinInUse.
2728
func readPassphrase(prompt string) ([]byte, error) {
28-
password := os.Getenv(SopsAgePasswordEnv)
29-
if password != "" {
30-
return []byte(password), nil
29+
if testing.Testing() {
30+
password := os.Getenv(SopsAgePasswordEnv)
31+
if password != "" {
32+
return []byte(password), nil
33+
}
3134
}
3235

3336
var in, out *os.File

0 commit comments

Comments
 (0)