Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions src/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class PowerShellProcess {
private static warnUserThreshold = 30;

public onExited: vscode.Event<void>;
private onExitedEmitter = new vscode.EventEmitter<void>();
private onExitedEmitter?: vscode.EventEmitter<void>;

private consoleTerminal?: vscode.Terminal;
private consoleCloseSubscription?: vscode.Disposable;
Expand All @@ -31,6 +31,7 @@ export class PowerShellProcess {
private sessionFilePath: vscode.Uri,
private sessionSettings: Settings) {

this.onExitedEmitter = new vscode.EventEmitter<void>();
this.onExited = this.onExitedEmitter.event;
}

Expand Down Expand Up @@ -149,6 +150,9 @@ export class PowerShellProcess {

void this.deleteSessionFile(this.sessionFilePath);

this.onExitedEmitter?.fire();
this.onExitedEmitter = undefined;

this.consoleTerminal?.dispose();
this.consoleTerminal = undefined;

Expand Down Expand Up @@ -230,7 +234,6 @@ export class PowerShellProcess {
}

this.logger.writeWarning(`PowerShell process terminated or Extension Terminal was closed, PID: ${this.pid}`);
this.onExitedEmitter.fire();
this.dispose();
}
}
4 changes: 2 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ export class SessionManager implements Middleware {
this.sessionSettings);

languageServerProcess.onExited(
async () => {
() => {
LanguageClientConsumer.onLanguageClientExited();

if (this.sessionStatus === SessionStatus.Running
|| this.sessionStatus === SessionStatus.Busy) {
this.setSessionStatus("Session Exited!", SessionStatus.Failed);
await this.promptForRestart();
void this.promptForRestart();
}
});

Expand Down