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); + } } } }