diff --git a/src/vs/workbench/electron-browser/crashReporter.ts b/src/vs/workbench/electron-browser/crashReporter.ts index 119229bc2d46f..9e17ed8926c22 100644 --- a/src/vs/workbench/electron-browser/crashReporter.ts +++ b/src/vs/workbench/electron-browser/crashReporter.ts @@ -15,6 +15,8 @@ import { Registry } from 'vs/platform/platform'; import { crashReporter } from 'electron'; import product from 'vs/platform/node/product'; import pkg from 'vs/platform/node/package'; +import * as os from 'os'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; const TELEMETRY_SECTION_ID = 'telemetry'; @@ -43,7 +45,8 @@ export class CrashReporter { configuration: Electron.CrashReporterStartOptions, @ITelemetryService telemetryService: ITelemetryService, @IWindowsService windowsService: IWindowsService, - @IConfigurationService configurationService: IConfigurationService + @IConfigurationService configurationService: IConfigurationService, + @IStorageService storageService: IStorageService ) { const config = configurationService.getConfiguration(TELEMETRY_SECTION_ID); @@ -52,14 +55,17 @@ export class CrashReporter { } telemetryService.getTelemetryInfo() - .then(info => ({ - vscode_sessionId: info.sessionId, - vscode_version: pkg.version, - vscode_commit: product.commit, - vscode_machineId: info.machineId - })) - .then(extra => assign(configuration, { extra })) - .then(configuration => { + .then(info => { + let extra = { + vscode_sessionId: info.sessionId, + vscode_version: pkg.version, + vscode_commit: product.commit, + vscode_machineId: info.machineId, + crashesDirectory: os.tmpdir() + }; + assign(configuration, { extra }); + storageService.store('crashReporterArgs', configuration, StorageScope.GLOBAL); + // start crash reporter right here crashReporter.start(clone(configuration)); diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index b7e6f6a378f88..c5dea1e200b79 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -31,6 +31,7 @@ import { TerminalLinkHandler } from 'vs/workbench/parts/terminal/electron-browse import { TerminalWidgetManager } from 'vs/workbench/parts/terminal/browser/terminalWidgetManager'; import { registerThemingParticipant, ITheme, ICssStyleCollector } from "vs/platform/theme/common/themeService"; import { scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground } from "vs/platform/theme/common/colorRegistry"; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; /** The amount of time to consider terminal errors to be related to the launch */ const LAUNCHING_DURATION = 500; @@ -97,7 +98,8 @@ export class TerminalInstance implements ITerminalInstance { @IPanelService private _panelService: IPanelService, @IWorkspaceContextService private _contextService: IWorkspaceContextService, @IWorkbenchEditorService private _editorService: IWorkbenchEditorService, - @IInstantiationService private _instantiationService: IInstantiationService + @IInstantiationService private _instantiationService: IInstantiationService, + @IStorageService private _storageService: IStorageService ) { this._instanceDisposables = []; this._processDisposables = []; @@ -467,7 +469,15 @@ export class TerminalInstance implements ITerminalInstance { } const env = TerminalInstance.createTerminalEnv(process.env, shell, this._getCwd(shell, workspace), locale, this._cols, this._rows); this._title = shell.name || ''; - this._process = cp.fork('./terminalProcess', [], { + let crashReporterArgs: Electron.CrashReporterStartOptions; + try { + crashReporterArgs = JSON.parse(this._storageService.get('crashReporterArgs', StorageScope.GLOBAL)); + crashReporterArgs.extra.processName = 'terminalProcess'; + } catch (error) { + // Error while parsing crash reporter args from local storage + } + let processArgs = crashReporterArgs ? [crashReporterArgs.toString()] : []; + this._process = cp.fork('./terminalProcess', processArgs, { env: env, cwd: URI.parse(path.dirname(require.toUrl('./terminalProcess'))).fsPath }); diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalProcess.js b/src/vs/workbench/parts/terminal/electron-browser/terminalProcess.js index 8cfea5673f1d7..d7fe5ce038175 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalProcess.js +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalProcess.js @@ -145,3 +145,10 @@ function sendProcessTitle() { }); currentTitle = ptyProcess.process; } + +try { + var crashReporterArgs = JSON.parse(process.argv[2]); + process.crashReporter.start(crashReporterArgs); +} catch (error) { + // Error while fetching crash reporter args +} \ No newline at end of file