Skip to content

Commit

Permalink
fix: Fix dropping of input when prompting for multiple values from pi…
Browse files Browse the repository at this point in the history
…ped stdin
  • Loading branch information
twpayne committed Jul 22, 2022
1 parent 24db084 commit 851efe3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ type Config struct {
homeDirAbsPath chezmoi.AbsPath
encryption chezmoi.Encryption

stdin io.Reader
stdout io.Writer
stderr io.Writer
stdin io.Reader
stdout io.Writer
stderr io.Writer
bufioReader *bufio.Reader

tempDirs map[string]chezmoi.AbsPath

Expand Down Expand Up @@ -1842,7 +1843,10 @@ func (c *Config) readLine(prompt string) (string, error) {
if err != nil {
return "", err
}
line, err := bufio.NewReader(c.stdin).ReadString('\n')
if c.bufioReader == nil {
c.bufioReader = bufio.NewReader(c.stdin)
}
line, err := c.bufioReader.ReadString('\n')
if err != nil {
return "", err
}
Expand Down

0 comments on commit 851efe3

Please sign in to comment.