fix: crash reproter arguments appeneded after '--' marker

Fixes https://github.com/microsoft/vscode/issues/108806
This commit is contained in:
deepak1556 2020-10-27 21:24:23 -07:00
parent a9bbd0c09c
commit bb16786cff

View file

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