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:
parent
949c637130
commit
d5fd776356
1 changed files with 5 additions and 1 deletions
|
|
@ -876,7 +876,11 @@ class Client extends EventEmitter {
|
||||||
* Closes the client
|
* Closes the client
|
||||||
*/
|
*/
|
||||||
async destroy() {
|
async destroy() {
|
||||||
await this.pupBrowser.close();
|
const browser = this.pupBrowser;
|
||||||
|
const isConnected = browser?.isConnected?.();
|
||||||
|
if (isConnected) {
|
||||||
|
await browser.close();
|
||||||
|
}
|
||||||
await this.authStrategy.destroy();
|
await this.authStrategy.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue