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 1695 1696 runPhase() { 1697 local curPhase="$*" 1698 if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then return; fi 1699 if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then return; fi ··· 1712 startTime=$(date +"%s") 1713 1714 # Evaluate the variable named $curPhase if it exists, otherwise the 1715 - # function named $curPhase. 1716 - eval "${!curPhase:-$curPhase}" 1717 1718 endTime=$(date +"%s") 1719 ··· 1725 1726 cd -- "${sourceRoot:-.}" 1727 fi 1728 } 1729 1730
··· 1694 1695 1696 runPhase() { 1697 + local retval=0 1698 local curPhase="$*" 1699 if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then return; fi 1700 if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then return; fi ··· 1713 startTime=$(date +"%s") 1714 1715 # Evaluate the variable named $curPhase if it exists, otherwise the 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}" 1719 1720 endTime=$(date +"%s") 1721 ··· 1727 1728 cd -- "${sourceRoot:-.}" 1729 fi 1730 + 1731 + return $retval 1732 } 1733 1734