Make HTTP requests cancellable when trying to connect (#8591)

Closes #8585.

Prior to this change, the `http` commands could get stuck for 30s while
attempting to make a connection to a remote server. After this change,
`ctrl+c` works as expected:


![image](https://user-images.githubusercontent.com/26268125/227395505-c2d5b19d-6228-4eac-836f-c0c3426b0c19.png)

To make this work, we perform blocking `ureq` calls in a background
thread and poll the channel while checking `ctrl+c`.
This commit is contained in:
Reilly Wood
2023-03-24 12:45:55 -07:00
committed by GitHub
parent dd22647fcd
commit b4b68afa17
8 changed files with 102 additions and 27 deletions

View File

@ -1056,6 +1056,13 @@ pub enum ShellError {
#[label("Could not access '{column_name}' on this record")]
span: Span,
},
/// Operation interrupted by user
#[error("Operation interrupted by user")]
InterruptedByUser {
#[label("This operation was interrupted")]
span: Option<Span>,
},
}
impl From<std::io::Error> for ShellError {