feat(nix/nint): accept attribute set with stdout, stderr and exit
This extends the calling convention for nint in a non-breaking way: If the called script returns an attribute set instead of a string the following is done: * If the attributes `stdout` and/or `stderr` exist, their content (which must be a string currently) is written to the respective output. * If the attribute `exit` exists, nint will exit with the given exit code. Must be a number that can be converted to an `i32`. If it's missing, nint will exit without indicating an error. Change-Id: I209cf178fee3d970fdea3b26e4049e944af47457 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3547 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
5dec982334
commit
852d059e2f
2 changed files with 57 additions and 3 deletions
|
|
@ -15,8 +15,16 @@ to the following calling convention:
|
|||
program name at `builtins.head argv`.
|
||||
* Extra arguments can be manually passed as described below.
|
||||
|
||||
* The return value should always be a string (throwing is also okay)
|
||||
which is printed to stdout by `nint`.
|
||||
* The return value must either be
|
||||
|
||||
* A string which is rendered to `stdout`.
|
||||
|
||||
* An attribute set with the following optional attributes:
|
||||
|
||||
* `stdout`: A string that's rendered to `stdout`
|
||||
* `stderr`: A string that's rendered to `stderr`
|
||||
* `exit`: A number which is used as an exit code.
|
||||
If missing, nint always exits with 0 (or equivalent).
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue