about summary refs log tree commit diff
path: root/users/Profpatsch/execline (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-02-13 r/2206 feat(users/Profpatsch/execline/exec_helpers): add no_args()Profpatsch1-0/+9
Some programs don’t need any arguments, so fail if they do get them, because that’s usually a bug. Change-Id: I28639056d3d9cea0cc0e7fcbfa42120c4f129c8c Reviewed-on: https://cl.tvl.fyi/c/depot/+/2503 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-13 r/2203 fix(users/Profpatsch/execline/exec_helpers): fix arg loop off-by-1Profpatsch1-1/+1
Change-Id: If20a91eaa6693ba35ce645b104c625dbd0c71726 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2500 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-02-06 r/2185 fix(users/Profpatsch/execline): fix exec_into_args off-by-1Profpatsch1-2/+2
We expect the users to pass an actual prog, not an argv, so 0 is the program to exec into. Also improve the exec error, by including the program we tried to exec into (the rust IO error doesn’t contain the name). Change-Id: I664f9f717e4f82bfc1b1da3bd7114124b7582d5f Reviewed-on: https://cl.tvl.fyi/c/depot/+/2489 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
2021-01-31 r/2176 feat(users/Profpatsch): add die_* helpers for semantic exit errorsProfpatsch1-1/+54
There is this semantic exit code schema championed by execline and skaware tooling, and we refined and documented it a bit in lorri https://github.com/nix-community/lorri/blob/d1d673d42090f0cfe8ab9b92b465315a9e7d30a3/src/ops/mod.rs#L24-L35 in the past. This just transcribes the error messages into simple helper functions. Applies the functions to the places where we would panic or die `sys::exit()` instead. Change-Id: I15ca05cd6f99a25a3378518be94110eab416354e Reviewed-on: https://cl.tvl.fyi/c/depot/+/2475 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 r/2175 feat(users/Profpatsch/execline): add args_for_execProfpatsch2-16/+42
`exec_into_args` would just read argv and exec into it, but we want to be able to write commands which take some positional arguments first. Thus we split the invocation into `args_for_exec`, which returns the positional arguments and prog, and then pass prog to `exec_into_args` when we want to exec eventually (prog is still an iterator at this point). Change-Id: I0b180c1a100b96363fe33ba2c42034ed41716b7a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2474 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-01-31 r/2171 feat(users/Profpatsch/execline): add exec helpersProfpatsch1-0/+27
Most tools end by execing into their argv, so here’s a small rust function which does the boilerplate. Change-Id: I9748955cf53828e02f04d7e8d74fbaf10c1158b5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2453 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>