Skip to content

Commit 96057d5

Browse files
evalbbatsov
authored andcommitted
Prevent showing errors for command check
Prevent errors showing up when check fails, e.g.: sh: line 169: hash: aspell: not found
1 parent a2b77b9 commit 96057d5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

utils/installer.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
has() {
2+
command -v "$1" >/dev/null 2>&1
3+
}
4+
15
install_prelude () {
26
printf " Cloning Emacs Prelude's GitHub repository...\n$RESET"
37
if [ x$PRELUDE_VERBOSE != x ]
@@ -157,7 +161,7 @@ fi
157161

158162
### Check dependencies
159163
printf "$CYAN Checking to see if git is installed... $RESET"
160-
if hash git 2>&-
164+
if has git
161165
then
162166
printf "$GREEN found.$RESET\n"
163167
else
@@ -166,7 +170,7 @@ else
166170
fi;
167171

168172
printf "$CYAN Checking to see if aspell is installed... "
169-
if hash aspell 2>&-
173+
if has aspell
170174
then
171175
printf "$GREEN found.$RESET\n"
172176
else
@@ -221,7 +225,7 @@ fi
221225

222226
if [ -z "$PRELUDE_SKIP_BC" ];
223227
then
224-
if which emacs > /dev/null 2>&1
228+
if has emacs
225229
then
226230
printf " Byte-compiling Prelude...\n"
227231
if [ x$PRELUDE_VERBOSE != x ]

0 commit comments

Comments
 (0)