Files
pad/cmd
xarmian 7d07bfa6a2 fix(cli): share stdin reader in login so piped --interactive works (BUG-1886) (#762)
doInteractiveLogin read the email line with one bufio.Reader, then
readPassword built a second independent bufio.Reader on os.Stdin. bufio
reads in chunks, so the first reader could buffer past its newline and
swallow the password line, breaking piped `pad auth login --interactive`.

Extract readPasswordFrom(fallback *bufio.Reader): TTY path unchanged
(term.ReadPassword, no echo); non-TTY fallback reads from the supplied
reader. doInteractiveLogin now shares its reader across email/password/2FA.
readPassword() stays as a fresh-reader wrapper for other callers.

Pre-existing bug (predates BUG-988). Verified: go test ./... (SQLite),
make test-pg (Postgres), make lint all green; new TestReadPasswordFromSharedReader
reproduces the email-then-password sequence.

Claude-Session: https://claude.ai/code/session_01WK9cUjxniBBAihGD5ygjDr
2026-06-24 11:45:29 -04:00
..