-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for data directory not being cleared during browser.close() panic #991
Conversation
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.
f88a8c8
to
4129498
Compare
There will be two temp clean dir tests. We need them to not look at what each other are creating and cause the test to pass/fail. So the current test will need to write to a new dir that is different to what the new test will write to.
When the context is closed before we call browser.close() used to cause a panic on the cdp command to close the browser. Since we've changed this to log instead of panic, we just need to make sure that the data dir does indeed get removed when the cdp command fails.
49ee8fd
to
b5ceb5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for working on this and fixing the issues. And also adding one more test 👏 Could you consider my suggestions? My suggestions also apply to the second test. Thanks!
1. Work with MkdirTemp to avoid dir name collisions. 2. Defer the cleanup before checking the error on MkdirTemp. 3. Work with RemoveAll to cleanup sub dirs and files incase the test fails so that the cleanup still occurs as expected. Resolves: #991 (comment) Resolves: #991 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
1. Work with MkdirTemp to avoid dir name collisions. 2. Defer the cleanup before checking the error on MkdirTemp. 3. Work with RemoveAll to cleanup sub dirs and files incase the test fails so that the cleanup still occurs as expected. Resolves: #991 (comment) Resolves: #991 (comment)
Description of changes
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.
Checklist