home-manager: exit with an error on build failure
Because 'set -e' has no effect on commands that run in an if condition,
the script was always exiting with no error when 'doBuild' failed.
As a bonus, $wrkdir is now always removed after building.
(cherry picked from commit a9d9fb5d75
)
This commit is contained in:
parent
5f2a6d90bd
commit
463d6db90b
|
@ -91,11 +91,13 @@ function doSwitch() {
|
|||
local wrkdir
|
||||
wrkdir="$(mktemp -d)"
|
||||
|
||||
if doBuild "$wrkdir/generation" ; then
|
||||
"$wrkdir/generation/activate"
|
||||
fi
|
||||
local exitCode=0
|
||||
doBuild "$wrkdir/generation" && "$wrkdir/generation/activate" || exitCode=1
|
||||
|
||||
# Because the previous command never fails, the script keeps running and
|
||||
# $wrkdir is always removed.
|
||||
rm -r "$wrkdir"
|
||||
return $exitCode
|
||||
}
|
||||
|
||||
function doListGens() {
|
||||
|
|
Loading…
Reference in a new issue