Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
curusarn committed Jan 17, 2020
1 parent d2cc85a commit d3b1b84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ __resh_collect() {
#__RESH_GIT_TOPLEVEL="$(git rev-parse --show-toplevel)"
#__RESH_GIT_TOPLEVEL_EXIT_CODE=$?

if [ -n "$ZSH_VERSION" ]; then
if [ -n "${ZSH_VERSION-}" ]; then
# assume Zsh
local __RESH_PID="$$" # current pid
elif [ -n "$BASH_VERSION" ]; then
elif [ -n "${BASH_VERSION-}" ]; then
# assume Bash
if [ "${BASH_VERSINFO[0]}" -ge "4" ]; then
# $BASHPID is only available in bash4+
Expand Down
8 changes: 7 additions & 1 deletion scripts/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ __resh_get_pid() {
local __RESH_PID="$$" # current pid
elif [ -n "${BASH_VERSION-}" ]; then
# assume Bash
local __RESH_PID="$BASHPID" # current pid
if [ "${BASH_VERSINFO[0]}" -ge "4" ]; then
# $BASHPID is only available in bash4+
# $$ is fairly similar so it should not be an issue
local __RESH_PID="$BASHPID" # current pid
else
local __RESH_PID="$$" # current pid
fi
fi
echo "$__RESH_PID"
}
Expand Down

0 comments on commit d3b1b84

Please sign in to comment.