]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - tests/setup.zsh
_autoenv_hash_pair: do not use a subshell (#81)
[zsh-autoenv.git] / tests / setup.zsh
index 31aee201214e80dd66c3cf9bd23ffa34f405c6d6..9b24765ea61452f171d51fae7bf17272e4110f30 100644 (file)
 
 export AUTOENV_AUTH_FILE="$CRAMTMP/autoenv/.autoenv_auth"
 
-if [[ $AUTOENV_AUTH_FILE[0,4] != '/tmp' ]]; then
-  echo "AUTOENV_AUTH_FILE is not in /tmp. Aborting."
-  return 1
-fi
-
 # Abort this setup script on any error.
 _save_errexit=${options[errexit]}
 set -e
@@ -31,7 +26,10 @@ fi
 # Add file ($1), version ($2), and optional hash ($3) to authentication file.
 test_autoenv_add_to_env() {
   [[ -d ${AUTOENV_AUTH_FILE:h} ]] || mkdir -p ${AUTOENV_AUTH_FILE:h}
-  _autoenv_hash_pair $1 1 ${2:-} >>| $AUTOENV_AUTH_FILE
+  {
+    local ret_pair
+    _autoenv_hash_pair $1 1 ${2:-} && echo $ret_pair
+  } >>| $AUTOENV_AUTH_FILE
 }
 
 # Add enter and leave env files to authentication file.