Skip to content

Commit

Permalink
Fix a possible panic
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Dec 21, 2023
1 parent 5e67e8c commit aa95353
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions testing/integration/container_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ func TestContainerCMD(t *testing.T) {
}

t.Cleanup(func() {
t.Log(">> cleaning up: killing the Elastic-Agent process")
if err := cmd.Process.Kill(); err != nil {
t.Fatalf("could not kill Elastic-Agent process: %s", err)
if cmd.Process != nil {
t.Log(">> cleaning up: killing the Elastic-Agent process")
if err := cmd.Process.Kill(); err != nil {
t.Fatalf("could not kill Elastic-Agent process: %s", err)
}
return
}
t.Log(">> cleaning up: no process to kill")
})

agentOutput := strings.Builder{}
Expand Down

0 comments on commit aa95353

Please sign in to comment.