diff --git a/pkg/proc/proc.go b/pkg/proc/proc.go index cfd5a3dc..de9aa639 100644 --- a/pkg/proc/proc.go +++ b/pkg/proc/proc.go @@ -112,6 +112,9 @@ func (pe ProcessExitedError) Error() string { // Detach from the process being debugged, optionally killing it. func (dbp *Process) Detach(kill bool) (err error) { + if dbp.exited { + return nil + } if dbp.Running() { if err = dbp.Halt(); err != nil { return diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index 2c6ff995..3d157932 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -40,7 +40,7 @@ func withTestProcess(name string, t testing.TB, fn func(p *Process, fixture prot defer func() { p.Halt() - p.Kill() + p.Detach(true) }() fn(p, fixture)