xtask: Exit feedback loop on EOF

This commit is contained in:
Jonas Platte 2021-04-14 19:09:57 +02:00
parent bc62192e60
commit 4bc25f836a
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -204,7 +204,6 @@ impl ReleaseTask {
/// Commit and push all the changes in the git repository.
fn commit(&self) -> Result<()> {
let mut input = String::new();
let stdin = stdin();
let instructions = "Ready to commit the changes. [continue/abort/diff]: ";
@ -213,7 +212,13 @@ impl ReleaseTask {
let mut handle = stdin.lock();
while let _ = handle.read_line(&mut input)? {
let mut input = String::new();
loop {
let eof = handle.read_line(&mut input)? == 0;
if eof {
return Err("User aborted commit".into());
}
match input.trim().to_ascii_lowercase().as_str() {
"c" | "continue" => {
break;