From 41294982134be70593bbc6ed90fadd7f2abb71c7 Mon Sep 17 00:00:00 2001 From: ankur22 Date: Wed, 2 Aug 2023 15:28:24 +0100 Subject: [PATCH] Update panic to log when cdp close fails While testing for another change, it became apparent that the panic when working with browser.close() would prevent any of the remaining data directories from being cleaned up in the temporary directory. Instead of panicking, we're going to log an error and carry on with rest of the process to try and close the subprocess and eventually delete the data directory. This change does indeed bring about the behaviour we want even when the context has been closed. --- common/browser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/browser.go b/common/browser.go index b9d9f4cf4..a0a0598c0 100644 --- a/common/browser.go +++ b/common/browser.go @@ -453,7 +453,7 @@ func (b *Browser) Close() { var closeErr *websocket.CloseError err := cdpbrowser.Close().Do(cdp.WithExecutor(b.ctx, b.conn)) if err != nil && !errors.As(err, &closeErr) { - k6ext.Panic(b.ctx, "closing the browser: %v", err) + b.logger.Errorf("Browser:Close", "closing the browser: %v", err) } }