mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 20:34:52 +03:00
Define closeNest before exitHandler
This prevents "closeNest: command not found" messages if setup fails early.
This commit is contained in:
parent
4982143324
commit
41e1900ea1
@ -72,6 +72,35 @@ _eval() {
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Logging.
|
||||
|
||||
nestingLevel=0
|
||||
|
||||
startNest() {
|
||||
nestingLevel=$(($nestingLevel + 1))
|
||||
echo -en "\033[$1p"
|
||||
}
|
||||
|
||||
stopNest() {
|
||||
nestingLevel=$(($nestingLevel - 1))
|
||||
echo -en "\033[q"
|
||||
}
|
||||
|
||||
header() {
|
||||
startNest "$2"
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
# Make sure that even when we exit abnormally, the original nesting
|
||||
# level is properly restored.
|
||||
closeNest() {
|
||||
while [ $nestingLevel -gt 0 ]; do
|
||||
stopNest
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Error handling.
|
||||
|
||||
@ -409,32 +438,6 @@ substituteAllInPlace() {
|
||||
# What follows is the generic builder.
|
||||
|
||||
|
||||
nestingLevel=0
|
||||
|
||||
startNest() {
|
||||
nestingLevel=$(($nestingLevel + 1))
|
||||
echo -en "\033[$1p"
|
||||
}
|
||||
|
||||
stopNest() {
|
||||
nestingLevel=$(($nestingLevel - 1))
|
||||
echo -en "\033[q"
|
||||
}
|
||||
|
||||
header() {
|
||||
startNest "$2"
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
# Make sure that even when we exit abnormally, the original nesting
|
||||
# level is properly restored.
|
||||
closeNest() {
|
||||
while [ $nestingLevel -gt 0 ]; do
|
||||
stopNest
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# This function is useful for debugging broken Nix builds. It dumps
|
||||
# all environment variables to a file `env-vars' in the build
|
||||
# directory. If the build fails and the `-K' option is used, you can
|
||||
|
Loading…
Reference in New Issue
Block a user