Skip to content

Commit

Permalink
packetbeat/route: fix defaultRoute test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 committed Jun 7, 2024
1 parent 7666aa9 commit adf4ad4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packetbeat/route/route_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ func defaultRoute(af int) (name string, index int, err error) {
}
sc := bufio.NewScanner(bytes.NewReader(r))
for inTable := false; sc.Scan(); {
f := strings.Fields(sc.Text())
if len(f) == 0 {
if len(bytes.TrimSpace(sc.Bytes())) == 0 {
if inTable {
break
}
continue
}
f := strings.Fields(sc.Text())
if !inTable {
inTable = f[0] == "-------"
continue
Expand Down

0 comments on commit adf4ad4

Please sign in to comment.