Commit 18effd77 authored by Xiao Fan's avatar Xiao Fan Committed by Marc Cornellà

last-working-dir: disable chpwd_last_working_dir in subshells (#6817)

parent e8c328cb
...@@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY ...@@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY
# Updates the last directory once directory is changed # Updates the last directory once directory is changed
chpwd_functions+=(chpwd_last_working_dir) chpwd_functions+=(chpwd_last_working_dir)
chpwd_last_working_dir() { chpwd_last_working_dir() {
local cache_file="$ZSH_CACHE_DIR/last-working-dir" if [ "$ZSH_SUBSHELL" = 0 ]; then
pwd >| "$cache_file" local cache_file="$ZSH_CACHE_DIR/last-working-dir"
pwd >| "$cache_file"
fi
} }
# Changes directory to the last working directory # Changes directory to the last working directory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment