feat(users/Profpatsch/lib): add eprint-stdin-netencode
Like `eprint-stdin`, but reads stdin as netencode and pretty-prints it to stderr. Change-Id: I430c010b0cac45f077cde9dadfd79adfa7a53eca Reviewed-on: https://cl.tvl.fyi/c/depot/+/2533 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
parent
5ca71308a8
commit
c98dd8b352
2 changed files with 17 additions and 3 deletions
|
|
@ -38,12 +38,12 @@ let
|
|||
extern crate exec_helpers;
|
||||
|
||||
fn main() {
|
||||
let (_, prog) = exec_helpers::args_for_exec("eprint-stdin-netencode", 0);
|
||||
let (_, prog) = exec_helpers::args_for_exec("netencode-pretty", 0);
|
||||
let mut buf = vec![];
|
||||
let u = netencode::u_from_stdin_or_die_user_error("eprint-stdin-netencode", &mut buf);
|
||||
let u = netencode::u_from_stdin_or_die_user_error("netencode-pretty", &mut buf);
|
||||
match netencode_pretty::Pretty::from_u(u).print_multiline(&mut std::io::stdout()) {
|
||||
Ok(()) => {},
|
||||
Err(err) => exec_helpers::die_temporary("eprint-stdin-netencode", format!("could not write to stdout: {}", err))
|
||||
Err(err) => exec_helpers::die_temporary("netencode-pretty", format!("could not write to stdout: {}", err))
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue