fix: end quietly when a reader leaves the pipe early

This commit is contained in:
2026-09-08 14:21:16 +00:00
parent 1ecf7f1ee4
commit 99010cb641
4 changed files with 57 additions and 27 deletions

View File

@@ -12,7 +12,7 @@ use anyhow::{Result, anyhow, bail};
use self::store::{Repo, ignored, resolve, symlink_metadata_opt, tracked};
use crate::ctx::Ctx;
use crate::fsops::{move_path, place_link, prune_empty, remove_file, rename, suffixed};
use crate::output::{note, warning};
use crate::output::{line, note, warning};
const BACKUP_SUFFIX: &str = ".ahab-bak";
@@ -200,10 +200,10 @@ pub fn list(ctx: &Ctx, store: Option<&Path>) -> Result<()> {
let repo = Repo::discover(ctx, store)?;
let stored = stored_paths(&repo, &repo.store)?;
println!("store: {}", repo.store.display());
line!("store: {}", repo.store.display());
if stored.is_empty() {
println!("nothing in the store for this repository");
line!("nothing in the store for this repository");
return Ok(());
}
@@ -215,7 +215,7 @@ pub fn list(ctx: &Ctx, store: Option<&Path>) -> Result<()> {
Stored::Taken => "shadowed",
};
println!("\t{:<11}{}", format!("{verb}:"), rel.display());
line!("\t{:<11}{}", format!("{verb}:"), rel.display());
}
Ok(())
@@ -237,10 +237,10 @@ impl Report {
fn line(&self, verb: &str, path: &Path) {
// worth naming once per run
if !self.named.replace(true) {
println!("store: {}", self.store.display());
line!("store: {}", self.store.display());
}
println!("\t{:<11}{}", format!("{verb}:"), path.display());
line!("\t{:<11}{}", format!("{verb}:"), path.display());
}
}