diff options
author | Profpatsch <mail@profpatsch.de> | 2021-02-14T15·55+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-04-23T20·45+0000 |
commit | c98dd8b352c4dac33ebb7302eaf527eb4b681502 (patch) | |
tree | 6598306f55574e3b0b09cd538ae0a5dfa0fe0c86 /users/Profpatsch/lib.nix | |
parent | 5ca71308a8f1ab61a3991991dd27bbb373a0d25f (diff) |
feat(users/Profpatsch/lib): add eprint-stdin-netencode r/2545
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>
Diffstat (limited to 'users/Profpatsch/lib.nix')
-rw-r--r-- | users/Profpatsch/lib.nix | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/users/Profpatsch/lib.nix b/users/Profpatsch/lib.nix index db81c2dfe321..1e9652a27986 100644 --- a/users/Profpatsch/lib.nix +++ b/users/Profpatsch/lib.nix @@ -21,6 +21,19 @@ let "pipeline" [ bins.multitee "0-1,2" ] "$@" ]; + eprint-stdin-netencode = depot.nix.writeExecline "eprint-stdin-netencode" {} [ + "pipeline" [ + # move stdout to 3 + "fdmove" "3" "1" + # the multitee copies stdin to 1 (the other pipeline end) and 3 (the stdout of the outer pipeline block) + "pipeline" [ bins.multitee "0-1,3" ] + # make stderr the stdout of pretty, merging with the stderr of pretty + "fdmove" "-c" "1" "2" + depot.users.Profpatsch.netencode.pretty + ] + "$@" + ]; + eprintenv = depot.nix.writeExecline "eprintenv" { readNArgs = 1; } [ "ifelse" [ "fdmove" "-c" "1" "2" bins.printenv "$1" ] [ "$@" ] @@ -43,6 +56,7 @@ in { debugExec eprintf eprint-stdin + eprint-stdin-netencode eprintenv runInEmptyEnv ; |