git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #79967 from grahamc/nixos-enter-fd2

nixos-enter: redirect to fd2 instead of a file named /dev/stderr

commitddd09101c50ff93f47732a66ac6eb1f5084e67c7 authorGraham Christensen <graham@grahamc.com> dateThu 13 Feb 2020, 11:39 (7 years ago) parentc87ec932d42fc2
1 file changed+9−9
nixos/modules/installer/tools/nixos-enter.sh+9−9
nixos/modules/installer/tools/nixos-enter.sh+9−9
@@ -60,15 +60,15 @@ chmod 0755 "$mountPoint/dev" "$mountPoint/sys"
6060mount --rbind /dev "$mountPoint/dev"
6161mount --rbind /sys "$mountPoint/sys"
6262
63−# If silent, write both stdout and stderr of activation script to /dev/null
64−# otherwise, write both streams to stderr of this process
65−if [ "$silent" -eq 0 ]; then
66− PIPE_TARGET="/dev/stderr"
67−else
68− PIPE_TARGET="/dev/null"
69−fi
63+(
64+ # If silent, write both stdout and stderr of activation script to /dev/null
65+ # otherwise, write both streams to stderr of this process
66+ if [ "$silent" -eq 1 ]; then
67+ exec 2>/dev/null
68+ fi
7069
71−# Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings.
72−LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" >>$PIPE_TARGET 2>&1 || true
70+ # Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings.
71+ LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" 1>&2 || true
72+)
7373
7474exec chroot "$mountPoint" "${command[@]}"