From d5fd7763565d35d6032cdb004be9c53310d79437 Mon Sep 17 00:00:00 2001 From: Adi1231234 Date: Fri, 30 Jan 2026 05:58:41 +0200 Subject: [PATCH] avoid hang by closing browser only if connected (#3847) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --------- Co-authored-by: Claude Opus 4.5 --- src/Client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index a6393e6..f68491f 100644 --- a/src/Client.js +++ b/src/Client.js @@ -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(); }