Skip to content

Commit

Permalink
fixes #83205
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Oct 24, 2019
1 parent 81cf723 commit a143fc3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/vs/code/electron-main/sharedProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import { assign } from 'vs/base/common/objects';
import { memoize } from 'vs/base/common/decorators';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { BrowserWindow, ipcMain } from 'electron';
import { BrowserWindow, ipcMain, WebContents, Event as ElectronEvent } from 'electron';
import { ISharedProcess } from 'vs/platform/ipc/electron-main/sharedProcessMainService';
import { Barrier } from 'vs/base/common/async';
import { ILogService } from 'vs/platform/log/common/log';
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';

export class SharedProcess implements ISharedProcess {

Expand Down Expand Up @@ -53,7 +54,7 @@ export class SharedProcess implements ISharedProcess {
this.window.loadURL(url);

// Prevent the window from dying
const onClose = (e: Event) => {
const onClose = (e: ElectronEvent) => {
this.logService.trace('SharedProcess#close prevented');

// We never allow to close the shared process unless we get explicitly disposed()
Expand Down Expand Up @@ -97,7 +98,8 @@ export class SharedProcess implements ISharedProcess {
});

return new Promise<void>(c => {
ipcMain.once('handshake:hello', ({ sender }: { sender: any }) => {
const onHello = Event.once(Event.fromNodeEventEmitter(ipcMain, 'handshake:hello', ({ sender }: { sender: WebContents }) => sender));
disposables.add(onHello(sender => {
sender.send('handshake:hey there', {
sharedIPCHandle: this.environmentService.sharedIPCHandle,
args: this.environmentService.args,
Expand All @@ -106,7 +108,7 @@ export class SharedProcess implements ISharedProcess {

disposables.add(toDisposable(() => sender.send('handshake:goodbye')));
ipcMain.once('handshake:im ready', () => c(undefined));
});
}));
});
}

Expand Down

0 comments on commit a143fc3

Please sign in to comment.