stdenv: `runPhase` returns status (#330751)

authored by philiptaron.tngl.sh and committed by GitHub 6f40e946 84e7de03

+6 -2
+6 -2
pkgs/stdenv/generic/setup.sh
··· 1694 1694 1695 1695 1696 1696 runPhase() { 1697 + local retval=0 1697 1698 local curPhase="$*" 1698 1699 if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then return; fi 1699 1700 if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then return; fi ··· 1712 1713 startTime=$(date +"%s") 1713 1714 1714 1715 # Evaluate the variable named $curPhase if it exists, otherwise the 1715 - # function named $curPhase. 1716 - eval "${!curPhase:-$curPhase}" 1716 + # function named $curPhase. Trap errors in subshell to set non-zero retval. 1717 + trap 'retval=1; trap - ERR' ERR 1718 + eval "set -o errtrace; ${!curPhase:-$curPhase}" 1717 1719 1718 1720 endTime=$(date +"%s") 1719 1721 ··· 1725 1727 1726 1728 cd -- "${sourceRoot:-.}" 1727 1729 fi 1730 + 1731 + return $retval 1728 1732 } 1729 1733 1730 1734