mirror of
https://github.com/NixOS/nix
synced 2025-07-09 03:43:54 +02:00
ProgressBar::ask: Accept EOF as a no
This may occur when stderr is a tty but stdin is empty. E.g. $ nix build </dev/null error: unexpected EOF reading a line These stdio handles are how some non-interactive sandboxes behave, including the Nix build sandbox and Hercules CI Effects.
This commit is contained in:
parent
f7b1e535a3
commit
3112e59734
3 changed files with 12 additions and 1 deletions
|
@ -27,7 +27,17 @@ cat <<EOF > flake.nix
|
|||
EOF
|
||||
|
||||
# Without --accept-flake-config, the post hook should not run.
|
||||
# To test variations in stderr tty-ness, we run the command in different ways,
|
||||
# none of which should block on stdin or accept the `nixConfig`s.
|
||||
nix build < /dev/null
|
||||
nix build < /dev/null 2>&1 | cat
|
||||
# EOF counts as no, even when interactive (throw EOF error before)
|
||||
if type -p script >/dev/null && script -q -c true /dev/null; then
|
||||
echo "script is available and GNU-like, so we can ensure a tty"
|
||||
script -q -c 'nix build < /dev/null' /dev/null
|
||||
else
|
||||
echo "script is not available or not GNU-like, so we skip testing with an added tty"
|
||||
fi
|
||||
(! [[ -f post-hook-ran ]])
|
||||
TODO_NixOS
|
||||
clearStore
|
||||
|
|
|
@ -60,6 +60,7 @@ mkMesonDerivation (finalAttrs: {
|
|||
# etc.
|
||||
busybox-sandbox-shell
|
||||
# For Overlay FS tests need `mount`, `umount`, and `unshare`.
|
||||
# For `script` command (ensuring a TTY)
|
||||
# TODO use `unixtools` to be precise over which executables instead?
|
||||
util-linux
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue