From 3c7f976acc1181e0ca619a0a87f0fb0c1a501d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Thu, 16 Jan 2020 14:33:02 +0100 Subject: [PATCH] call defer cmd.Wait() before return --- GetRuntimeAddresses/symbolyze/gdb_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/GetRuntimeAddresses/symbolyze/gdb_test.go b/GetRuntimeAddresses/symbolyze/gdb_test.go index 720403f..c76951d 100644 --- a/GetRuntimeAddresses/symbolyze/gdb_test.go +++ b/GetRuntimeAddresses/symbolyze/gdb_test.go @@ -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") }