avoid hang by closing browser only if connected (#3847)

* avoid hang by closing browser only if connected

* fix: correct indentation in destroy() method

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adi1231234 2026-01-30 05:58:41 +02:00 • committed by GitHub
commit d5fd776356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -876,7 +876,11 @@ class Client extends EventEmitter {
* Closes the client
*/
async destroy() {
await this.pupBrowser.close();
const browser = this.pupBrowser;
const isConnected = browser?.isConnected?.();
if (isConnected) {
await browser.close();
}
await this.authStrategy.destroy();
}