提交 4f89ece6 编写于 作者: C Christof Marti

Set machineId in shared process (fixes #20349)

上级 6fccb171
......@@ -97,8 +97,9 @@ export function _futureMachineIdExperiment(): string {
return mac.value;
}
let machineId: TPromise<string>;
export function getMachineId(): TPromise<string> {
return new TPromise<string>(resolve => {
return machineId || (machineId = new TPromise<string>(resolve => {
try {
getmac.getMac((error, macAddress) => {
if (!error) {
......@@ -111,5 +112,5 @@ export function getMachineId(): TPromise<string> {
errors.onUnexpectedError(err);
resolve(uuid.generateUuid()); // fallback, generate a UUID
}
});
}));
}
......@@ -7,6 +7,7 @@ import * as Platform from 'vs/base/common/platform';
import * as os from 'os';
import { TPromise } from 'vs/base/common/winjs.base';
import * as uuid from 'vs/base/common/uuid';
import { getMachineId } from 'vs/base/node/id';
export function resolveCommonProperties(commit: string, version: string): TPromise<{ [name: string]: string; }> {
const result: { [name: string]: string; } = Object.create(null);
......@@ -16,6 +17,7 @@ export function resolveCommonProperties(commit: string, version: string): TPromi
result['version'] = version;
result['common.osVersion'] = os.release();
result['common.platform'] = Platform.Platform[Platform.platform];
const promise = getMachineId().then(value => result['common.machineId'] = value);
// dynamic properties which value differs on each call
let seq = 0;
......@@ -35,5 +37,5 @@ export function resolveCommonProperties(commit: string, version: string): TPromi
}
});
return TPromise.as(result);
return promise.then(() => result);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册