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

Did you mean [...]? + ctr-c => thread 'main2' panicked #11704

Open
TApplencourt opened this issue Feb 22, 2025 · 1 comment · May be fixed by #11706
Open

Did you mean [...]? + ctr-c => thread 'main2' panicked #11704

TApplencourt opened this issue Feb 22, 2025 · 1 comment · May be fixed by #11706
Labels
bug Something isn't working

Comments

@TApplencourt
Copy link

Summary

Hi,

Nothing major, but when the prompt ask for are you sure? if you ctr+c (I'm too lazy to type n)make the rust panick:

(h2yaml) adowa@pop-os:~/h2yaml$ uv pip install h2yaml pyproject.toml 
? `pyproject.toml` looks like a local metadata file but was passed as a package name. Did you mean `-r pyproject.toml`? [y/n] › yesthread 'main2' panicked at crates/uv-requirements/src/sources.rs:115:78:
called `Result::unwrap()` on an `Err` value: Custom { kind: Interrupted, error: "read interrupted" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Please feel free to close, nothing important,

Thanks a lot for uv!

Regards,
Thomas

Platform

Linux 6.9.3-76060903-generic x86_64 GNU/Linux

Version

uv 0.5.27

Python version

Python 3.10.12

@TApplencourt TApplencourt added the bug Something isn't working label Feb 22, 2025
@TApplencourt TApplencourt changed the title Did you mean + ctr-c => thread 'main2' panicked Did you mean [...]? + ctr-c => thread 'main2' panicked Feb 22, 2025
@ericmarkmartin
Copy link
Contributor

I think what's going on here is that we call console's read_key in uv-console's confirm will, upon receiving Ctrl-C

  1. raise SIGINT
  2. return an io::ErrorKind::Interrupted error (this is actually just forwarded from console's read under-the-hood)

At the beginning of confirm we register a Ctrl-C handler which calls process::exit, which runs in a background thread. Due to (1), this handler is run, which in turn calls process::exit. This forces the main thread to unwind, and hence the interrupted error gets returned and then unwrapd at crates/uv-requirements/src/sources.rs:115:78 (as given by the error message).

I have a fix that looks like it works, so I'll PR it shortly

@ericmarkmartin ericmarkmartin linked a pull request Feb 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants