summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Base/Completer/_external_pwds6
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 603466e2f..cf1751770 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-13  Oliver Kiddle  <opk@zsh.org>
+
+	* 39299: Completion/Base/Completer/_external_pwds: better
+	Freebsd support in _external_pwds using procstat
+
 2016-09-13  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 39292: Config/version.mk, Src/cond.c, Src/parse.c, Src/text.c,
diff --git a/Completion/Base/Completer/_external_pwds b/Completion/Base/Completer/_external_pwds
index 79e3ba0eb..a9dc859f1 100644
--- a/Completion/Base/Completer/_external_pwds
+++ b/Completion/Base/Completer/_external_pwds
@@ -22,9 +22,13 @@ case $OSTYPE in
     )
   ;;
   linux*)
-    dirs=( /proc/${^$(pidof zsh):#$$}/cwd(N:P) )
+    dirs=( /proc/${^$(pidof -- -zsh zsh):#$$}/cwd(N:P) )
     dirs=( $^dirs(N^@) )
   ;;
+  freebsd*)
+    dirs=( $(pgrep -U $UID -x zsh) )
+    dirs=( $(procstat -h -f $dirs|awk '{if ($3 == "cwd") print $NF}') )
+  ;;
   *)
     if (( $+commands[lsof] )); then
       dirs=( ${${${(M)${(f)"$(lsof -a -u $EUID -c zsh -p \^$$ -d cwd -F n -w