mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Split stdin on new line
Pacman 5.1 changed the stdin seperation from whitespace to newline. To maintain corectness we should also do this.
This commit is contained in:
parent
bd3e1cd3a9
commit
b4c102a17a
1 changed files with 8 additions and 14 deletions
22
parser.go
22
parser.go
|
@ -1,10 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -537,21 +537,15 @@ func (parser *arguments) parseLongOption(arg string, param string) (usedNext boo
|
|||
return
|
||||
}
|
||||
|
||||
func (parser *arguments) parseStdin() (err error) {
|
||||
for {
|
||||
var target string
|
||||
_, err = fmt.Scan(&target)
|
||||
func (parser *arguments) parseStdin() error {
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
parser.addTarget(target)
|
||||
for scanner.Scan() {
|
||||
parser.addTarget(scanner.Text())
|
||||
}
|
||||
|
||||
return os.Stdin.Close()
|
||||
}
|
||||
|
||||
func (parser *arguments) parseCommandLine() (err error) {
|
||||
|
|
Loading…
Reference in a new issue