pw_env_setup: Fix alias check when 'set -e'

This suppresses the failure of 'alias python' when 'python' is not an
alias so it can run under 'set -e' without exiting early.

Change-Id: I879954cb42791de50e613e22e2dd2d4ed38336e0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/42140
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Janusz Sobczak <jsobczak@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_env_setup/util.sh b/pw_env_setup/util.sh
index 0365d52..0706fc4 100644
--- a/pw_env_setup/util.sh
+++ b/pw_env_setup/util.sh
@@ -193,8 +193,9 @@
 pw_bootstrap() {
   _pw_hello "  BOOTSTRAP! Bootstrap may take a few minutes; please be patient.\n"
 
-  alias python > /dev/null 2> /dev/null
-  if [ "$?" -eq 0 ]; then
+  _pw_alias_check=0
+  alias python > /dev/null 2> /dev/null || _pw_alias_check=$?
+  if [ "$_pw_alias_check" -eq 0 ]; then
     pw_bold_red "Error: 'python' is an alias"
     pw_red "The shell has a 'python' alias set. This causes many obscure"
     pw_red "Python-related issues both in and out of Pigweed. Please remove"
@@ -297,4 +298,5 @@
   unset pw_activate
   unset pw_finalize
   unset _pw_cleanup
+  unset _pw_alias_check
 }