Skip to content

Commit

Permalink
environment - add OS info (#106528)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Nov 13, 2020
1 parent ee46c1f commit 38f55ec
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as os from 'os';
import * as path from 'vs/base/common/path';
import * as objects from 'vs/base/common/objects';
import * as nls from 'vs/nls';
Expand Down Expand Up @@ -799,6 +800,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Parts splash
windowConfiguration.partsSplashPath = path.join(this.environmentService.userDataPath, 'rapid_render.json');

// OS Info
windowConfiguration.os = {
release: os.release()
};

// Config (combination of process.argv and window configuration)
const environment = parseArgs(process.argv, OPTIONS);
const config = Object.assign(environment, windowConfiguration) as unknown as { [key: string]: unknown };
Expand Down
6 changes: 6 additions & 0 deletions src/vs/platform/windows/common/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ export interface IWindowConfiguration {
filesToDiff?: IPath[];
}

export interface IOSConfiguration {
release: string;
}

export interface INativeWindowConfiguration extends IWindowConfiguration, NativeParsedArgs {
mainPid: number;

Expand All @@ -256,6 +260,8 @@ export interface INativeWindowConfiguration extends IWindowConfiguration, Native

userEnv: IProcessEnvironment;
filesToWait?: IPathsToWaitFor;

os: IOSConfiguration;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
sessionId = this.configuration.sessionId;
machineId = this.configuration.machineId;
remoteAuthority = this.configuration.remoteAuthority;
os = { release: 'unknown' };

options?: IWorkbenchConstructionOptions | undefined;
logExtensionHostCommunication?: boolean | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import { join } from 'vs/base/common/path';
import { IProductService } from 'vs/platform/product/common/productService';
import { IOSConfiguration } from 'vs/platform/windows/common/windows';

export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService implements INativeWorkbenchEnvironmentService {

Expand Down Expand Up @@ -82,6 +83,10 @@ export class NativeWorkbenchEnvironmentService extends NativeEnvironmentService
return undefined;
}

get os(): IOSConfiguration {
return this.configuration.os;
}

constructor(
readonly configuration: INativeWorkbenchConfiguration,
private readonly productService: IProductService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { IWorkbenchConfiguration, IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { INativeWindowConfiguration } from 'vs/platform/windows/common/windows';
import { INativeWindowConfiguration, IOSConfiguration } from 'vs/platform/windows/common/windows';
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';

Expand All @@ -27,6 +27,8 @@ export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmen

readonly log?: string;

readonly os: IOSConfiguration;

// TODO@ben this is a bit ugly
updateBackupPath(newPath: string | undefined): void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/ur
import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IOSProperties, IOSStatistics } from 'vs/platform/native/common/native';
import { homedir } from 'os';
import { homedir, release } from 'os';

export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = {
windowId: 0,
Expand All @@ -54,6 +54,7 @@ export const TestWorkbenchConfiguration: INativeWorkbenchConfiguration = {
execPath: process.execPath,
perfEntries: [],
colorScheme: { dark: true, highContrast: false },
os: { release: release() },
...parseArgs(process.argv, OPTIONS)
};

Expand Down

0 comments on commit 38f55ec

Please sign in to comment.