Re-wrap functions as functions. Fixes issue with RVM reload (cd wrapper will be overwritten without error)

This commit is contained in:
Nathan Broadbent
2013-01-30 22:29:05 +13:00
parent 3692db6a3a
commit dd10be79e2
2 changed files with 4 additions and 3 deletions

View File

@@ -60,8 +60,8 @@ if [ "$shell_command_wrapping_enabled" = "true" ] || [ "$bash_command_wrapping_e
eval "$(declare -f $cmd | sed -E "s/^$cmd \(\)/__original_$cmd ()/")"
# Remove function
unset -f $cmd
# Create wrapped alias for old function
alias "$cmd"="exec_scmb_expand_args __original_$cmd";;
# Create function that wraps old function
eval "${cmd}(){ exec_scmb_expand_args __original_${cmd} \"\$@\"; }";;
*'is a shell builtin'*)
if [ "${scmbDebug:-}" = "true" ]; then echo "SCMB: $cmd is a shell builtin"; fi