-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ed3e96
commit 146d0dd
Showing
4 changed files
with
52 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/Razor/src/Microsoft.AspNetCore.Razor.VSCode/src/BlazorDebug/Events.ts
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/Razor/src/Microsoft.AspNetCore.Razor.VSCode/src/BlazorDebug/TerminateDebugHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
|
||
import * as psList from 'ps-list'; | ||
import { DebugSession } from 'vscode'; | ||
|
||
import { RazorLogger } from '../RazorLogger'; | ||
|
||
export async function onDidTerminateDebugSession( | ||
event: DebugSession, | ||
logger: RazorLogger, | ||
targetPid: number | undefined, | ||
) { | ||
if (!targetPid) { | ||
return; | ||
} | ||
|
||
logger.logVerbose(`[DEBUGGER] Terminating debugging session with PID ${targetPid}...`); | ||
|
||
let processes: psList.ProcessDescriptor[] = []; | ||
try { | ||
processes = await psList(); | ||
} catch (error) { | ||
logger.logError(`Error retrieving processes under PID ${targetPid} to clean-up: `, error); | ||
} | ||
|
||
try { | ||
process.kill(targetPid); | ||
processes.map((proc) => { | ||
if (proc.ppid === targetPid) { | ||
process.kill(proc.pid); | ||
} | ||
}); | ||
logger.logVerbose(`[DEBUGGER] Debug process clean-up of PID ${targetPid} complete.`); | ||
} catch (error) { | ||
logger.logError(`[DEBUGGER] Error terminating debug processes with PID ${targetPid}: `, error); | ||
} | ||
} |