Skip to content

Commit 46af79c

Browse files
Improve error message when browser-ui-test crashes
1 parent a72f0c2 commit 46af79c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/tools/rustdoc-gui/tester.js

+16
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ async function main(argv) {
201201
process.setMaxListeners(opts["jobs"] + 1);
202202
}
203203

204+
// We catch this "event" to display a nicer message in case of unexpected exit (because of a
205+
// missing `--no-sandbox`).
206+
const exitHandling = (code) => {
207+
if (!opts["no_sandbox"]) {
208+
console.log("");
209+
console.log(
210+
"`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args \
211+
--no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`");
212+
console.log("");
213+
}
214+
};
215+
process.on('exit', exitHandling);
216+
204217
const tests_queue = [];
205218
let results = {
206219
successful: [],
@@ -247,6 +260,9 @@ async function main(argv) {
247260
}
248261
status_bar.finish();
249262

263+
// We don't need this listener anymore.
264+
process.removeListener("exit", exitHandling);
265+
250266
if (debug) {
251267
results.successful.sort(by_filename);
252268
results.successful.forEach(r => {

0 commit comments

Comments
 (0)