From eb66e87593c070d3c47107da2674fc6699273e65 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 29 Sep 2018 23:02:00 +0800 Subject: [PATCH] Improve error handling --- ghcup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghcup.sh b/ghcup.sh index 3e8b660..2ab3b9e 100755 --- a/ghcup.sh +++ b/ghcup.sh @@ -283,6 +283,7 @@ install_ghc() { } for f in "${inst_location}"/bin/*-"${myghcver}" ; do + [ -e "${f}" ] || die "Something went wrong, ${f} does not exist!" fn=$(basename "${f}") # shellcheck disable=SC2046 edo ln $(echov "-v") -sf ../ghc/"${myghcver}/bin/${fn}" "${target_location}/${fn}" @@ -310,6 +311,7 @@ set_ghc() { printf_green "Setting GHC to ${myghcver}" for f in "${inst_location}"/bin/*-"${myghcver}" ; do + [ -e "${f}" ] || die "Something went wrong, ${f} does not exist!" source_fn=$(basename "${f}") target_fn=$(echo "${source_fn}" | sed "s#-${myghcver}##") # shellcheck disable=SC2046