call defer cmd.Wait() before return

This commit is contained in:
Özgür Kesim 2020-01-16 14:33:02 +01:00
parent 4ba4442100
commit 3c7f976acc

View File

@ -103,6 +103,8 @@ func extractOffsetWithGdb(pid int, t *testing.T) (offset uint64, err error) {
return 0, err
}
defer cmd.Wait()
scanner := bufio.NewScanner(output)
for scanner.Scan() {
line := scanner.Text()
@ -113,9 +115,5 @@ func extractOffsetWithGdb(pid int, t *testing.T) (offset uint64, err error) {
}
}
if err := cmd.Wait(); err != nil {
return 0, err
}
return 0, fmt.Errorf("Symbol not found with gdb")
}