e9b11f3b0648c94a6067b4054e1fd0d3a8baa304

Author
Michael Aquilina <michaelaquilina@gmail.com>
Committer
Michael Aquilina <michaelaquilina@gmail.com>
Date

Message

Use chpwd because preexec runs before changing directory

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index e259f356347ea6fdafb57f8f450b1223a1317a6d..f3f9656cd0ff1cf2ed11a3e0ea4eceabed231f5e 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -130,5 +130,5 @@ function mkvenv()
 6 }
 7 
 8 autoload -Uz add-zsh-hook
 9-add-zsh-hook -D preexec _check_venv
10-add-zsh-hook preexec _check_venv
11+add-zsh-hook -D chpwd _check_venv
12+add-zsh-hook chpwd _check_venv
13diff --git a/tests/test_check_venv_path.zunit b/tests/test_check_venv_path.zunit
14index c3098790ffb0f43be60051ed97a7da1818871f2e..04a8f56ff67518045a2f333f82753207d8c7de5a 100644
15--- a/tests/test_check_venv_path.zunit
16+++ b/tests/test_check_venv_path.zunit
17@@ -12,7 +12,7 @@
18 }
19 
20 @test 'chpwd functions are loaded' {
21-    assert '_check_venv' in $preexec_functions
22+    assert '_check_venv' in $chpwd_functions
23 }
24 
25 @test '_check_venv_path with non-existent path' {