Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Fix chrome session restore promt in Windows #606

Merged
merged 4 commits into from
Mar 14, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,21 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
// Only kill Chrome if the 'disconnect' originated from vscode. If we previously terminated
// due to Chrome shutting down, or devtools taking over, don't kill Chrome.
if (coreUtils.getPlatform() === coreUtils.Platform.Windows && this._chromePID) {
// Run synchronously because this process may be killed before exec() would run
const taskkillCmd = `taskkill /F /T /PID ${this._chromePID}`;
let taskkillCmd = `taskkill /PID ${this._chromePID}`;
logger.log(`Killing Chrome process by pid: ${taskkillCmd}`);
try {
execSync(taskkillCmd);
} catch (e) {
// Can fail if Chrome was already open, and the process with _chromePID is gone.
// Or if it already shut down for some reason.
}
if (!this._hasTerminated) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right way to check if the process is dead?

taskkillCmd = `taskkill /F /PID ${this._chromePID}`;
logger.log(`Killing Chrome process by pid: ${taskkillCmd}`);
try {
execSync(taskkillCmd);
} catch (e) {}
}
} else {
logger.log('Killing Chrome process');
this._chromeProc.kill('SIGINT');
Expand Down