Skip to content

Commit

Permalink
ctlv3: fix line parsing for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sinsharat committed Sep 8, 2016
1 parent bb3ba1e commit 8b764aa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions etcdctl/ctlv3/command/txn_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ func readCompares(r *bufio.Reader) (cmps []clientv3.Cmp) {
if err != nil {
ExitWithError(ExitInvalidInput, err)
}
if len(line) == 1 {

// remove space from the line
line = strings.TrimSpace(line)
if len(line) == 0 {
break
}

// remove trialling \n
line = line[:len(line)-1]
cmp, err := parseCompare(line)
if err != nil {
ExitWithError(ExitInvalidInput, err)
Expand All @@ -99,12 +100,13 @@ func readOps(r *bufio.Reader) (ops []clientv3.Op) {
if err != nil {
ExitWithError(ExitInvalidInput, err)
}
if len(line) == 1 {

// remove space from the line
line = strings.TrimSpace(line)
if len(line) == 0 {
break
}

// remove trialling \n
line = line[:len(line)-1]
op, err := parseRequestUnion(line)
if err != nil {
ExitWithError(ExitInvalidInput, err)
Expand Down

0 comments on commit 8b764aa

Please sign in to comment.