Detatch cleanly upon exit

This commit is contained in:
Derek Parker
2014-08-15 15:41:16 -05:00
parent 0e11797f8b
commit a5ee20a279

View File

@ -9,6 +9,7 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"syscall"
"github.com/derekparker/dbg/proctl" "github.com/derekparker/dbg/proctl"
) )
@ -66,6 +67,11 @@ func noCmdAvailable(p *proctl.DebuggedProcess, ars ...string) error {
} }
func exitFunc(p *proctl.DebuggedProcess, ars ...string) error { func exitFunc(p *proctl.DebuggedProcess, ars ...string) error {
err := syscall.PtraceDetach(p.Pid)
if err != nil {
return err
}
os.Exit(0) os.Exit(0)
return nil return nil
} }