fix: end quietly when a reader leaves the pipe early
This commit is contained in:
@@ -7,6 +7,7 @@ use anyhow::{Result, anyhow};
|
||||
use super::store::{Repo, resolve, symlink_metadata_opt};
|
||||
use crate::cmd::{Cmd, LsFiles};
|
||||
use crate::ctx::Ctx;
|
||||
use crate::output::{line, text};
|
||||
|
||||
pub fn check(
|
||||
ctx: &Ctx,
|
||||
@@ -55,17 +56,17 @@ fn print_porcelain(exposed: &[Exposed], null: bool) {
|
||||
|
||||
for item in exposed {
|
||||
match &item.dest {
|
||||
Some(dest) => print!("{} {} -> {}{end}", item.code(), item.name, dest.display()),
|
||||
None => print!("{} {}{end}", item.code(), item.name),
|
||||
Some(dest) => text!("{} {} -> {}{end}", item.code(), item.name, dest.display()),
|
||||
None => text!("{} {}{end}", item.code(), item.name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_listing(repo: &Repo, exposed: &[Exposed]) {
|
||||
println!("store: {}", repo.store.display());
|
||||
line!("store: {}", repo.store.display());
|
||||
|
||||
if exposed.is_empty() {
|
||||
println!("nothing outside the store, a sandbox would see tracked files only");
|
||||
line!("nothing outside the store, a sandbox would see tracked files only");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,11 +94,11 @@ fn print_listing(repo: &Repo, exposed: &[Exposed]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
println!("\n{heading}\n{hint}");
|
||||
line!("\n{heading}\n{hint}");
|
||||
for item in items {
|
||||
match &item.dest {
|
||||
Some(dest) => println!("\t{} -> {}", item.name, dest.display()),
|
||||
None => println!("\t{}", item.name),
|
||||
Some(dest) => line!("\t{} -> {}", item.name, dest.display()),
|
||||
None => line!("\t{}", item.name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user