proc: fix issue on Windows when launching process while detached (#3867)
When the Delve instance is running in a detached state and it launches a process an additional child conhost.exe process will be created, we should detach from it. Fixes #3864
This commit is contained in:
parent
5c12831340
commit
5d82dc10dc
@ -373,6 +373,17 @@ func (procgrp *processGroup) waitForDebugEvent(flags waitForDebugEventFlags) (th
|
|||||||
// This is a fake process group and waitForDebugEvent has been called
|
// This is a fake process group and waitForDebugEvent has been called
|
||||||
// just after attach/launch, finish configuring the root process.
|
// just after attach/launch, finish configuring the root process.
|
||||||
dbp = procgrp.procs[0]
|
dbp = procgrp.procs[0]
|
||||||
|
if debugEvent.ProcessId != uint32(dbp.pid) {
|
||||||
|
// When launching a new process while we are in detached state also
|
||||||
|
// creates a conhost.exe child process. This is that process and we
|
||||||
|
// need to detach from it.
|
||||||
|
// See issue #3864.
|
||||||
|
err := _DebugActiveProcessStop(debugEvent.ProcessId)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Add new child process
|
// Add new child process
|
||||||
dbp = newChildProcess(procgrp.procs[0], int(debugEvent.ProcessId))
|
dbp = newChildProcess(procgrp.procs[0], int(debugEvent.ProcessId))
|
||||||
|
Loading…
Reference in New Issue
Block a user