Merge pull request #79967 from grahamc/nixos-enter-fd2

nixos-enter: redirect to fd2 instead of a file named /dev/stderr
This commit is contained in:
Graham Christensen 2020-02-13 11:39:35 -05:00 committed by GitHub
commit ddd09101c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,15 +60,15 @@ chmod 0755 "$mountPoint/dev" "$mountPoint/sys"
mount --rbind /dev "$mountPoint/dev" mount --rbind /dev "$mountPoint/dev"
mount --rbind /sys "$mountPoint/sys" mount --rbind /sys "$mountPoint/sys"
# If silent, write both stdout and stderr of activation script to /dev/null (
# otherwise, write both streams to stderr of this process # If silent, write both stdout and stderr of activation script to /dev/null
if [ "$silent" -eq 0 ]; then # otherwise, write both streams to stderr of this process
PIPE_TARGET="/dev/stderr" if [ "$silent" -eq 1 ]; then
else exec 2>/dev/null
PIPE_TARGET="/dev/null" fi
fi
# Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings. # Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings.
LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" >>$PIPE_TARGET 2>&1 || true LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" 1>&2 || true
)
exec chroot "$mountPoint" "${command[@]}" exec chroot "$mountPoint" "${command[@]}"