From bb16786cff3d231facbdcee90741ac25fcffd3ac Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Tue, 27 Oct 2020 21:24:23 -0700 Subject: [PATCH] fix: crash reproter arguments appeneded after '--' marker Fixes https://github.com/microsoft/vscode/issues/108806 --- src/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index a901a747b92..61d31e0ad84 100644 --- a/src/main.js +++ b/src/main.js @@ -79,7 +79,16 @@ if (crashReporterDirectory) { submitURL = submitURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', crashReporterId); // Send the id for child node process that are explicitly starting crash reporter. // For vscode this is ExtensionHost process currently. - process.argv.push('--crash-reporter-id', crashReporterId); + const argv = process.argv; + const endOfArgsMarkerIndex = argv.indexOf('--'); + if (endOfArgsMarkerIndex === -1) { + argv.push('--crash-reporter-id', crashReporterId); + } else { + // if the we have an argument "--" (end of argument marker) + // we cannot add arguments at the end. rather, we add + // arguments before the "--" marker. + argv.splice(endOfArgsMarkerIndex, 0, '--crash-reporter-id', crashReporterId); + } } } }