mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
ctlv3: fix line parsing for Windows
This commit is contained in:
parent
2435eb9ecd
commit
ee2717493a
@ -77,12 +77,13 @@ func readCompares(r *bufio.Reader) (cmps []clientv3.Cmp) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ExitWithError(ExitInvalidInput, err)
|
ExitWithError(ExitInvalidInput, err)
|
||||||
}
|
}
|
||||||
if len(line) == 1 {
|
|
||||||
|
// remove space from the line
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
if len(line) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trialling \n
|
|
||||||
line = line[:len(line)-1]
|
|
||||||
cmp, err := parseCompare(line)
|
cmp, err := parseCompare(line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ExitWithError(ExitInvalidInput, err)
|
ExitWithError(ExitInvalidInput, err)
|
||||||
@ -99,12 +100,13 @@ func readOps(r *bufio.Reader) (ops []clientv3.Op) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ExitWithError(ExitInvalidInput, err)
|
ExitWithError(ExitInvalidInput, err)
|
||||||
}
|
}
|
||||||
if len(line) == 1 {
|
|
||||||
|
// remove space from the line
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
if len(line) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove trialling \n
|
|
||||||
line = line[:len(line)-1]
|
|
||||||
op, err := parseRequestUnion(line)
|
op, err := parseRequestUnion(line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ExitWithError(ExitInvalidInput, err)
|
ExitWithError(ExitInvalidInput, err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user