Report linux desktop-related env vars in issue reporter

Fixes #94388
This commit is contained in:
Daniel Imms 2020-04-05 09:12:10 -07:00
parent 5b0460a67e
commit ebbc6591de
4 changed files with 75 additions and 3 deletions

View file

@ -168,6 +168,13 @@ ${this.getInfos()}
|Screen Reader|${this._data.systemInfo.screenReader}|
|VM|${this._data.systemInfo.vmHint}|`;
if (this._data.systemInfo.linuxEnv) {
md += `\n|DESKTOP_SESSION|${this._data.systemInfo.linuxEnv.desktopSession}|
|XDG_CURRENT_DESKTOP|${this._data.systemInfo.linuxEnv.xdgCurrentDesktop}|
|XDG_SESSION_DESKTOP|${this._data.systemInfo.linuxEnv.xdgSessionDesktop}|
|XDG_SESSION_TYPE|${this._data.systemInfo.linuxEnv.xdgSessionType}|`;
}
this._data.systemInfo.remoteData.forEach(remote => {
if (isRemoteDiagnosticError(remote)) {
md += `\n\n${remote.errorMessage}`;
@ -268,4 +275,4 @@ ${table}
</details>`;
}
}
}

View file

@ -81,6 +81,55 @@ OS version: undefined
<!-- generated by issue reporter -->`);
});
test('serializes Linux environment information when data is provided', () => {
const issueReporterModel = new IssueReporterModel({
issueType: 0,
systemInfo: {
os: 'Darwin',
cpus: 'Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)',
memory: '16.00GB',
vmHint: '0%',
processArgs: '',
screenReader: 'no',
remoteData: [],
gpuStatus: {},
linuxEnv: {
desktopSession: 'ubuntu',
xdgCurrentDesktop: 'ubuntu',
xdgSessionDesktop: 'ubuntu:GNOME',
xdgSessionType: 'x11'
}
}
});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
VS Code version: undefined
OS version: undefined
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)|
|GPU Status||
|Load (avg)|undefined|
|Memory (System)|16.00GB|
|Process Argv||
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|ubuntu|
|XDG_CURRENT_DESKTOP|ubuntu|
|XDG_SESSION_DESKTOP|ubuntu:GNOME|
|XDG_SESSION_TYPE|x11|
</details>Extensions: none
<!-- generated by issue reporter -->`);
});
test('serializes remote information when data is provided', () => {
const issueReporterModel = new IssueReporterModel({
issueType: 0,

View file

@ -13,6 +13,14 @@ export interface IMachineInfo {
cpus?: string;
memory: string;
vmHint: string;
linuxEnv?: ILinuxEnv;
}
export interface ILinuxEnv {
desktopSession?: string;
xdgSessionDesktop?: string;
xdgCurrentDesktop?: string;
xdgSessionType?: string;
}
export interface IDiagnosticInfo {

View file

@ -11,7 +11,7 @@ import { parse, ParseError, getNodeType } from 'vs/base/common/json';
import { listProcesses } from 'vs/base/node/ps';
import product from 'vs/platform/product/common/product';
import { repeat, pad } from 'vs/base/common/strings';
import { isWindows } from 'vs/base/common/platform';
import { isWindows, isLinux } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import { ProcessItem } from 'vs/base/common/processes';
import { IMainProcessInfo } from 'vs/platform/launch/common/launch';
@ -336,11 +336,19 @@ export class DiagnosticsService implements IDiagnosticsService {
remoteData
};
if (!isWindows) {
systemInfo.load = `${osLib.loadavg().map(l => Math.round(l)).join(', ')}`;
}
if (isLinux) {
systemInfo.linuxEnv = {
desktopSession: process.env.DESKTOP_SESSION,
xdgSessionDesktop: process.env.XDG_SESSION_DESKTOP,
xdgCurrentDesktop: process.env.XDG_CURRENT_DESKTOP,
xdgSessionType: process.env.XDG_SESSION_TYPE
};
}
return Promise.resolve(systemInfo);
}