Skip to content

Commit

Permalink
Improve error message when browser-ui-test crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 11, 2022
1 parent a72f0c2 commit 46af79c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tools/rustdoc-gui/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,19 @@ async function main(argv) {
process.setMaxListeners(opts["jobs"] + 1);
}

// We catch this "event" to display a nicer message in case of unexpected exit (because of a
// missing `--no-sandbox`).
const exitHandling = (code) => {
if (!opts["no_sandbox"]) {
console.log("");
console.log(
"`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args \
--no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`");
console.log("");
}
};
process.on('exit', exitHandling);

const tests_queue = [];
let results = {
successful: [],
Expand Down Expand Up @@ -247,6 +260,9 @@ async function main(argv) {
}
status_bar.finish();

// We don't need this listener anymore.
process.removeListener("exit", exitHandling);

if (debug) {
results.successful.sort(by_filename);
results.successful.forEach(r => {
Expand Down

0 comments on commit 46af79c

Please sign in to comment.