Skip to content

Commit

Permalink
fix: regression on multiline console input (#2329)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge authored May 28, 2024
1 parent 7a01ad7 commit 03ba2d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/utils/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func NewConsole() Console {
token: make(chan string),
}
go func() {
// Scan a single line from input or file
if !c.stdin.Scan() {
fmt.Fprintln(c.logger, io.EOF)
// Scan line by line from input or file
for c.stdin.Scan() {
c.token <- strings.TrimSpace(c.stdin.Text())
}
if err := c.stdin.Err(); err != nil {
fmt.Fprintln(c.logger, err)
}
c.token <- strings.TrimSpace(c.stdin.Text())
close(c.token)
}()
return c
}
Expand Down

0 comments on commit 03ba2d0

Please sign in to comment.