Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 706e848

Browse files
authored
Merge pull request #15 from wplib/14-set-cli-processvm
set-cli-processvm should check that binary exists before removing exi…
2 parents 44f602c + 67968d3 commit 706e848

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

guest/cli/includes/set-cli-processvm

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33
echo
44
echo "Setting CLI Process VM to $1..."
55

6-
sudo rm /etc/alternatives/php
7-
sudo ln -s "/usr/bin/$1" /etc/alternatives/php
6+
if [ -f "/usr/bin/$1" ]; then
7+
sudo rm /etc/alternatives/php
8+
sudo ln -s "/usr/bin/$1" /etc/alternatives/php
9+
error=0
10+
else
11+
echo "The $1 executable does not exist."
12+
error=1
13+
fi
814

915
echo
10-
php -v
16+
php -v
17+
18+
return $error

0 commit comments

Comments
 (0)