Skip to content

Commit f272bc4

Browse files
committed
fix: send ExitedEvent and TerminatedEvent on process exit (#763)
* Send ExitedEvent on process exit and TerminatedEvent on debug stop. * Do not blindly send TerminatedEvent on disconnect.
1 parent 9ee3ad7 commit f272bc4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/phpDebug.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ class PhpDebugSession extends vscode.DebugSession {
276276
)
277277
if (script) {
278278
// we only do this for CLI mode. In normal listen mode, only a thread exited event is send.
279-
script.on('exit', () => {
279+
script.on('exit', (code: number | null) => {
280+
this.sendEvent(new vscode.ExitedEvent(code ?? 0))
280281
this.sendEvent(new vscode.TerminatedEvent())
281282
})
282283
}
@@ -293,7 +294,8 @@ class PhpDebugSession extends vscode.DebugSession {
293294
this.sendEvent(new vscode.OutputEvent(data + '', 'stderr'))
294295
})
295296
// we only do this for CLI mode. In normal listen mode, only a thread exited event is send.
296-
script.on('exit', () => {
297+
script.on('exit', (code: number | null) => {
298+
this.sendEvent(new vscode.ExitedEvent(code ?? 0))
297299
this.sendEvent(new vscode.TerminatedEvent())
298300
})
299301
script.on('error', (error: Error) => {

0 commit comments

Comments
 (0)