Fix for broken pipe panics
This commit is contained in:
parent
e8f8969ded
commit
b9d04730db
1 changed files with 51 additions and 20 deletions
|
@ -41,8 +41,12 @@ extern crate libimagerror;
|
||||||
extern crate libimagentrylink;
|
extern crate libimagentrylink;
|
||||||
extern crate libimagstore;
|
extern crate libimagstore;
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
use libimagrt::setup::generate_runtime_setup;
|
use libimagrt::setup::generate_runtime_setup;
|
||||||
use libimagerror::trace::MapErrTrace;
|
use libimagerror::trace::MapErrTrace;
|
||||||
|
use libimagerror::io::ToExitCode;
|
||||||
|
use libimagerror::exit::ExitUnwrap;
|
||||||
use libimagstore::store::FileLockEntry;
|
use libimagstore::store::FileLockEntry;
|
||||||
use libimagstore::storeid::StoreId;
|
use libimagstore::storeid::StoreId;
|
||||||
use libimagstore::error::StoreError as Error;
|
use libimagstore::error::StoreError as Error;
|
||||||
|
@ -151,39 +155,66 @@ fn main() {
|
||||||
|
|
||||||
let n = diags.len();
|
let n = diags.len();
|
||||||
|
|
||||||
println!("imag version {}", env!("CARGO_PKG_VERSION"));
|
let mut out = ::std::io::stdout();
|
||||||
println!("");
|
|
||||||
println!("{} entries", n);
|
let _ = writeln!(out, "imag version {}", env!("CARGO_PKG_VERSION"))
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
|
let _ = writeln!(out, "")
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
|
let _ = writeln!(out, "{} entries", n)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
for (k, v) in version_counts {
|
for (k, v) in version_counts {
|
||||||
println!("{} entries with store version '{}'", v, k);
|
let _ = writeln!(out, "{} entries with store version '{}'", v, k)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
}
|
}
|
||||||
if n != 0 {
|
if n != 0 {
|
||||||
println!("{} header sections in the average entry", sum_header_sections / n);
|
let _ = writeln!(out, "{} header sections in the average entry", sum_header_sections / n)
|
||||||
println!("{} average content bytecount", sum_bytecount_content / n);
|
.to_exit_code()
|
||||||
println!("{} average overall bytecount", sum_overall_byte_size / n);
|
.unwrap_or_exit();
|
||||||
|
let _ = writeln!(out, "{} average content bytecount", sum_bytecount_content / n)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
|
let _ = writeln!(out, "{} average overall bytecount", sum_overall_byte_size / n)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
if let Some((num, path)) = max_overall_byte_size {
|
if let Some((num, path)) = max_overall_byte_size {
|
||||||
println!("Largest Entry ({bytes} bytes): {path}",
|
let _ = writeln!(out,
|
||||||
|
"Largest Entry ({bytes} bytes): {path}",
|
||||||
bytes = num,
|
bytes = num,
|
||||||
path = path
|
path = path
|
||||||
.into_pathbuf()
|
.into_pathbuf()
|
||||||
.map_err_trace_exit_unwrap(1)
|
.map_err_trace_exit_unwrap(1)
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap_or("Failed converting path to string")
|
.unwrap_or("Failed converting path to string")
|
||||||
);
|
)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
}
|
}
|
||||||
println!("{} average internal link count per entry", num_internal_links / n);
|
let _ = writeln!(out, "{} average internal link count per entry", num_internal_links / n)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
if let Some((num, path)) = max_internal_links {
|
if let Some((num, path)) = max_internal_links {
|
||||||
println!("Entry with most internal links ({count}): {path}",
|
let _ = writeln!(out, "Entry with most internal links ({count}): {path}",
|
||||||
count = num,
|
count = num,
|
||||||
path = path
|
path = path
|
||||||
.into_pathbuf()
|
.into_pathbuf()
|
||||||
.map_err_trace_exit_unwrap(1)
|
.map_err_trace_exit_unwrap(1)
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap_or("Failed converting path to string")
|
.unwrap_or("Failed converting path to string")
|
||||||
);
|
)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
}
|
}
|
||||||
println!("{} verified entries", verified_count);
|
let _ = writeln!(out, "{} verified entries", verified_count)
|
||||||
println!("{} unverified entries", unverified_count);
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
|
let _ = writeln!(out, "{} unverified entries", unverified_count)
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue