diff options
author | Profpatsch <mail@profpatsch.de> | 2021-02-13T13·24+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-02-13T20·00+0000 |
commit | 708f17d49b2efd721371fec88509f1e70e56b6e0 (patch) | |
tree | 0d999d857e8b42ee97283ea10fd6c1214fc8b064 /users/Profpatsch/netencode/default.nix | |
parent | 1d752f031b116a759a14322debf9faa0a834664c (diff) |
feat(users/Profpatsch/netencode/record-splice-env): ignore non-scal r/2210
The headers are not a scalar, so record-splice-env doesn’t know how to convert them to an envvar; let’s just ignore everything that can’t be converted to a scalar for now. Change-Id: I74ed0aa942fcd26beb058705830bc2f2b516e93e Reviewed-on: https://cl.tvl.fyi/c/depot/+/2523 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to '')
-rw-r--r-- | users/Profpatsch/netencode/default.nix | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/users/Profpatsch/netencode/default.nix b/users/Profpatsch/netencode/default.nix index 4965bb74f20c..a54a946d6e0a 100644 --- a/users/Profpatsch/netencode/default.nix +++ b/users/Profpatsch/netencode/default.nix @@ -131,15 +131,20 @@ let } '' extern crate netencode; extern crate exec_helpers; - use netencode::dec::{Record, ScalarAsBytes, Decoder, DecodeError}; + use netencode::dec::{Record, Try, ScalarAsBytes, Decoder, DecodeError}; fn main() { let mut buf = vec![]; let u = netencode::u_from_stdin_or_die_user_error("record-splice-env", &mut buf); let (_, prog) = exec_helpers::args_for_exec("record-splice-env", 0); - match Record(ScalarAsBytes).dec(u) { + match Record(Try(ScalarAsBytes)).dec(u) { Ok(map) => { - exec_helpers::exec_into_args("record-splice-env", prog, map); + exec_helpers::exec_into_args( + "record-splice-env", + prog, + // some elements can’t be decoded as scalars, so just ignore them + map.into_iter().filter_map(|(k, v)| v.map(|v2| (k, v2))) + ); }, Err(DecodeError(err)) => exec_helpers::die_user_error("record-splice-env", err), } |