mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
This commit is contained in:
parent
8daa0c10bf
commit
6317965640
|
@ -989,6 +989,8 @@ export class CodeApplication extends Disposable {
|
|||
private setupSharedProcess(machineId: string, sqmId: string): { sharedProcessReady: Promise<MessagePortClient>; sharedProcessClient: Promise<MessagePortClient> } {
|
||||
const sharedProcess = this._register(this.mainInstantiationService.createInstance(SharedProcess, machineId, sqmId));
|
||||
|
||||
this._register(sharedProcess.onDidCrash(() => this.windowsMainService?.sendToFocused('vscode:reportSharedProcessCrash')));
|
||||
|
||||
const sharedProcessClient = (async () => {
|
||||
this.logService.trace('Main->SharedProcess#connect');
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtil
|
|||
import { parseSharedProcessDebugPort } from 'vs/platform/environment/node/environmentService';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
import { SharedProcessChannelConnection, SharedProcessRawConnection, SharedProcessLifecycle } from 'vs/platform/sharedProcess/common/sharedProcess';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class SharedProcess extends Disposable {
|
||||
|
||||
|
@ -27,6 +28,9 @@ export class SharedProcess extends Disposable {
|
|||
private utilityProcess: UtilityProcess | undefined = undefined;
|
||||
private utilityProcessLogListener: IDisposable | undefined = undefined;
|
||||
|
||||
private readonly _onDidCrash = this._register(new Emitter<void>());
|
||||
readonly onDidCrash = this._onDidCrash.event;
|
||||
|
||||
constructor(
|
||||
private readonly machineId: string,
|
||||
private readonly sqmId: string,
|
||||
|
@ -168,6 +172,8 @@ export class SharedProcess extends Disposable {
|
|||
payload: this.createSharedProcessConfiguration(),
|
||||
execArgv
|
||||
});
|
||||
|
||||
this._register(this.utilityProcess.onCrash(() => this._onDidCrash.fire()));
|
||||
}
|
||||
|
||||
private createSharedProcessConfiguration(): ISharedProcessConfiguration {
|
||||
|
|
|
@ -196,6 +196,18 @@ export class NativeWindow extends BaseWindow {
|
|||
}
|
||||
});
|
||||
|
||||
// Shared Process crash reported from main
|
||||
ipcRenderer.on('vscode:reportSharedProcessCrash', (event: unknown, error: string) => {
|
||||
this.notificationService.prompt(
|
||||
Severity.Error,
|
||||
localize('sharedProcessCrash', "A shared background process terminated unexpectedly. Please restart the application to recover."),
|
||||
[{
|
||||
label: localize('restart', "Restart"),
|
||||
run: () => this.nativeHostService.relaunch()
|
||||
}]
|
||||
);
|
||||
});
|
||||
|
||||
// Support openFiles event for existing and new files
|
||||
ipcRenderer.on('vscode:openFiles', (event: unknown, request: IOpenFileRequest) => { this.onOpenFiles(request); });
|
||||
|
||||
|
|
Loading…
Reference in a new issue