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

Abnormal exit #7

Open
zibo-chen opened this issue Mar 10, 2024 · 4 comments
Open

Abnormal exit #7

zibo-chen opened this issue Mar 10, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@zibo-chen
Copy link

thread '' panicked at C:\Users\Administrator.cargo\registry\src\github.com-1ecc6299db9ec823\clipboard-rs-0.1.2\src\platform\win.rs:72:60:
Open clipboard: OSError(5)
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Recurrence method : When copying text in windows Terminal

@ChurchTao
Copy link
Owner

@zibo-chen
Could you please provide me with the code you run? I'll do a test.

@ChurchTao
Copy link
Owner

I see your error description is that the clipboard handle cannot be opened. I think this is a random situation. Can you try a few more times to check? Failure to obtain the clipboard handle is normal, so the code retries 10 times by default. If you still can't get it, is it possible that another program of yours is occupying the clipboard handle?

@ChurchTao ChurchTao added the bug Something isn't working label Mar 11, 2024
@zibo-chen
Copy link
Author

I frequently encounter this issue within Excel, but I have managed to resolve it by introducing a delay in the process. It seems that Excel might be writing to the clipboard multiple times in quick succession, which could cause the program to fail in obtaining the clipboard handle. By adding a pause, it allows enough time for the clipboard to become available again before the program attempts to access it. This workaround has been effective for me.

@ChurchTao
Copy link
Owner

@zibo-chen
I understand the problem you mentioned. Your guess is correct. I will try to see if it can be optimized. When I have the handle, I don’t need to get the handle again. This should solve your problem.

@ChurchTao ChurchTao added help wanted Extra attention is needed and removed bug Something isn't working labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants