Only detach if not killing process
This commit is contained in:
parent
c414c72ec9
commit
9040ec1af1
@ -135,22 +135,22 @@ func (d *Debugger) Run() error {
|
||||
}
|
||||
}
|
||||
|
||||
// Detach
|
||||
if !d.process.Exited() {
|
||||
if err := sys.PtraceDetach(d.process.Pid); err == nil {
|
||||
log.Print("detached from process")
|
||||
} else {
|
||||
log.Printf("couldn't detach from process: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Kill the process if requested
|
||||
if s.KillProcess {
|
||||
if err := d.process.Process.Kill(); err == nil {
|
||||
if err := proctl.PtraceCont(d.process.Pid, int(sys.SIGINT)); err == nil {
|
||||
log.Print("killed process")
|
||||
} else {
|
||||
log.Printf("couldn't kill process: %s", err)
|
||||
}
|
||||
} else {
|
||||
// Detach
|
||||
if !d.process.Exited() {
|
||||
if err := sys.PtraceDetach(d.process.Pid); err == nil {
|
||||
log.Print("detached from process")
|
||||
} else {
|
||||
log.Printf("couldn't detach from process: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user