Skip to content

Commit 4d252ac

Browse files
authored
sandbox - configure crash reporter with process type (microsoft#174927)
1 parent 784bbda commit 4d252ac

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/bootstrap-fork.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,22 @@ function terminateWhenParentTerminates() {
239239
function configureCrashReporter() {
240240
const crashReporterSandboxedHint = process.env['VSCODE_CRASH_REPORTER_SANDBOXED_HINT'];
241241
if (crashReporterSandboxedHint) {
242-
try {
243-
if (process['crashReporter'] && typeof process['crashReporter'].addExtraParameter === 'function' /* Electron only */) {
244-
process['crashReporter'].addExtraParameter('_sandboxed', 'true');
245-
}
246-
} catch (error) {
247-
console.error(error);
242+
addCrashReporterParameter('_sandboxed', 'true');
243+
}
244+
245+
const crashReporterProcessType = process.env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'];
246+
if (crashReporterProcessType) {
247+
addCrashReporterParameter('processType', crashReporterProcessType);
248+
}
249+
}
250+
251+
function addCrashReporterParameter(key, value) {
252+
try {
253+
if (process['crashReporter'] && typeof process['crashReporter'].addExtraParameter === 'function' /* Electron only */) {
254+
process['crashReporter'].addExtraParameter(key, value);
248255
}
256+
} catch (error) {
257+
console.error(error);
249258
}
250259
}
251260

src/vs/platform/utilityProcess/electron-main/utilityProcess.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ export class UtilityProcess extends Disposable {
237237
env['VSCODE_PARENT_PID'] = String(configuration.parentLifecycleBound);
238238
}
239239
if (isWindowSandboxed) {
240-
env['VSCODE_CRASH_REPORTER_SANDBOXED_HINT'] = '1';
240+
env['VSCODE_CRASH_REPORTER_SANDBOXED_HINT'] = '1'; // TODO@bpasero remove me once sandbox is final
241241
}
242+
env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'] = configuration.type;
242243

243244
// Remove any environment variables that are not allowed
244245
removeDangerousEnvVariables(env);

0 commit comments

Comments
 (0)