Skip to content

Commit

Permalink
Update panic to log when cdp close fails
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ankur22 committed Aug 2, 2023
1 parent 642bc7d commit f88a8c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit f88a8c8

Please sign in to comment.