Skip to content
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: Check webshot2 result for screenshot success in gtsave_extra #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrembert
Copy link

Fixes Issue

This pull request addresses an issue where the gtsave_extra function was not reliably detecting whether the screenshot was saved successfully when using webshot2::webshot. The original code relied on utils::capture.output(type = "message") to capture output from webshot2, but this was not working consistently, likely due to the asynchronous nature of webshot2 and how it handles output from Chrome/Chromium.

Proposed Solution

This PR modifies gtsave_extra to use the return value of webshot2::webshot (which is the path to the saved screenshot file) and file.exists() to check if the screenshot file was actually created. This provides a more robust and reliable way to determine if the screenshot operation was successful.

Changes Made

  • Modified gtsave_extra to use webshot2::webshot's return value and file.exists().
  • Removed the code that used utils::capture.output().

This change ensures that gtsave_extra correctly reports success or failure when saving screenshots, improving the reliability of the function.

The gtsave_extra function now correctly checks the return value of
webshot2::webshot and uses file.exists() to verify that the screenshot
was saved successfully. This avoids relying on capture.output(),
which was not reliably capturing output from webshot2."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant