Skip to content

Commit

Permalink
[zsh] use sh trap to ensure popd always happens
Browse files Browse the repository at this point in the history
  • Loading branch information
meain committed May 10, 2024
1 parent b82a8d0 commit 9e4b91b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions zsh/.config/zsh/functions
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ q() {

m() {
r >/dev/null

trap popd>/dev/null 1 2 3 6

if [ ! -d .mscripts ]; then
popd >/dev/null
echo "Unable to find .mscripts" && return 1
fi
script="$1"
Expand All @@ -100,22 +102,21 @@ m() {

if [ -z "$mscript" ]; then
echo "No mscript avaialble for $script"
popd >/dev/null
return 1
fi

eval .mscripts/"$mscript" $*
popd >/dev/null
}

mm() {
r >/dev/null
trap popd>/dev/null 1 2 3 6

if [ ! -f .mscripts/default ]; then
echo "Unable to find default mscript" && return 1
fi

.mscripts/default "$@"
popd >/dev/null
}

# python venv setup (need to be function as we have to source)
Expand Down

0 comments on commit 9e4b91b

Please sign in to comment.