summaryrefslogtreecommitdiff
path: root/helix-term/src/main.rs
diff options
context:
space:
mode:
authorNirmal Patel2022-03-30 05:09:25 +0000
committerGitHub2022-03-30 05:09:25 +0000
commit8702aaaefcc3a069947b4e52a9c1f57868f32b5c (patch)
treebe93beedad5b636a7d51adc893480135d337fada /helix-term/src/main.rs
parent7cd60502358440449935a50b4d95fa6527312037 (diff)
Handle BrokenPipe when piping hx --health through head (#1876)
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r--helix-term/src/main.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index 0385d92c..4a3434d1 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -88,16 +88,14 @@ FLAGS:
}
if args.health {
- if let Some(lang) = args.health_arg {
- match lang.as_str() {
- "all" => helix_term::health::languages_all(),
- _ => helix_term::health::language(lang),
+ if let Err(err) = helix_term::health::print_health(args.health_arg) {
+ // Piping to for example `head -10` requires special handling:
+ // https://stackoverflow.com/a/65760807/7115678
+ if err.kind() != std::io::ErrorKind::BrokenPipe {
+ return Err(err.into());
}
- } else {
- helix_term::health::general();
- println!();
- helix_term::health::languages_all();
}
+
std::process::exit(0);
}