diff --git a/buildtools/check-example.js b/buildtools/check-example.js index a0be181082c2..79a8164bc87a 100644 --- a/buildtools/check-example.js +++ b/buildtools/check-example.js @@ -294,6 +294,8 @@ function loaded(page, browser) { loaded(page, browser); })().catch(async (error) => { console.log(`Unexpected error: ${error}.`); - await browser.close(); + if (browser && !browserClosed) { + await browser.close(); + } process.exit(2); });