diff --git a/src/vs/base/test/node/id.test.ts b/src/vs/base/test/node/id.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c01f23d8c143f92f0a5f2a935f8a5e24ccc388f --- /dev/null +++ b/src/vs/base/test/node/id.test.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import * as assert from 'assert'; +import { getMachineId } from 'vs/base/node/id'; + +suite('ID', () => { + + test('getMachineId', function () { + return getMachineId().then(id => { + assert.ok(id); + }); + }); +}); \ No newline at end of file diff --git a/src/vs/code/electron-browser/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcessMain.ts index c7022d60bbdba3bebeed030b7fbf50acc199ed12..4a49a6ff0586d1e21813f36d3bd84c0b1e60d02b 100644 --- a/src/vs/code/electron-browser/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcessMain.ts @@ -37,7 +37,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { createSharedProcessContributions } from 'vs/code/electron-browser/contrib/contributions'; export interface ISharedProcessConfiguration { - machineId: string; + readonly machineId: string; } export function startup(configuration: ISharedProcessConfiguration) { diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 55a4260c8bf7699bdff5af146b5e45e82310ce99..7d171a33abb1abdb38ee412590a61392e1cede9a 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -257,7 +257,9 @@ export class CodeApplication { this.electronIpcServer = new ElectronIPCServer(); // Resolve unique machine ID + this.logService.log('Resolving machine identifier...'); return this.resolveMachineId().then(machineId => { + this.logService.log(`Resolved machine identifier: ${machineId}`); // Spawn shared process this.sharedProcess = new SharedProcess(this.environmentService, machineId, this.userEnv); diff --git a/src/vs/code/electron-main/sharedProcess.ts b/src/vs/code/electron-main/sharedProcess.ts index fd42fdea3db4405dd181c7e94795a9494022fa2a..7c1edf759064adfbfe2fbe63e5d547cd1ed1bbad 100644 --- a/src/vs/code/electron-main/sharedProcess.ts +++ b/src/vs/code/electron-main/sharedProcess.ts @@ -20,6 +20,12 @@ export class SharedProcess implements ISharedProcess { private window: Electron.BrowserWindow; private disposables: IDisposable[] = []; + constructor( + private environmentService: IEnvironmentService, + private readonly machineId: string, + private readonly userEnv: IProcessEnvironment + ) { } + @memoize private get _whenReady(): TPromise { this.window = new BrowserWindow({ @@ -77,12 +83,6 @@ export class SharedProcess implements ISharedProcess { }); } - constructor( - private environmentService: IEnvironmentService, - private machineId: string, - private userEnv: IProcessEnvironment - ) { } - spawn(): void { this.barrier.open(); } diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 09e45364abc93c69f28c204b69dd428d80bf07c9..7fa508277ff920e4bdb67f908999008f8b7c016a 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -138,7 +138,7 @@ export class WindowsManager implements IWindowsMainService { onWindowsCountChanged: CommonEvent = this._onWindowsCountChanged.event; constructor( - private machineId: string, + private readonly machineId: string, @ILogService private logService: ILogService, @IStorageMainService private storageMainService: IStorageMainService, @IEnvironmentService private environmentService: IEnvironmentService,