aboutsummaryrefslogtreecommitdiff
path: root/internal/readpassword/read.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/readpassword/read.go')
-rw-r--r--internal/readpassword/read.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/readpassword/read.go b/internal/readpassword/read.go
index 3ad3bb4..582a104 100644
--- a/internal/readpassword/read.go
+++ b/internal/readpassword/read.go
@@ -87,7 +87,14 @@ func readPasswordTerminal(prompt string) ([]byte, error) {
// readPasswordStdin reads a line from stdin.
// It exits with a fatal error on read error or empty result.
func readPasswordStdin(prompt string) ([]byte, error) {
- tlog.Info.Printf("Reading %s from stdin", prompt)
+ // This should make debugging situations like
+ // https://github.com/rfjakob/gocryptfs/issues/852
+ // easier. Only works on Linux, otherwise shows "?".
+ target, err := os.Readlink("/proc/self/fd/0")
+ if err != nil {
+ target = "?"
+ }
+ tlog.Info.Printf("Reading %s from stdin (connected to %q)", prompt, target)
p, err := readLineUnbuffered(os.Stdin)
if err != nil {
return nil, err