Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 21 lines 463 B view raw
1# Exit with backtrace and error message 2# 3# Usage: die "Error message" 4die() { 5 # Let us be a little sloppy with errors, because otherwise the final 6 # invocation of `caller` below will cause the script to exit. 7 set +e 8 9 # Print our error message 10 printf "\nBuilder called die: %b\n" "$*" 11 printf "Backtrace:\n" 12 13 # Print a backtrace. 14 local frame=0 15 while caller $frame; do 16 ((frame++)); 17 done 18 printf "\n" 19 20 exit 1 21}