]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/rustdoc-gui/tester.js
Rollup merge of #98200 - ouz-a:issue-98177, r=oli-obk
[rust.git] / src / tools / rustdoc-gui / tester.js
index a5121850369151582fc62858909e07febfa49f4e..70d5f94472f6b598829a7256a47e95c642a0d2c6 100644 (file)
@@ -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: [],
@@ -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 => {