Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _file_descriptors: initialize `list' array with local -a
- X-seq: zsh-workers 35483
- From: Eric Cook <llua@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] _file_descriptors: initialize `list' array with local -a
- Date: Tue, 16 Jun 2015 01:31:08 -0400
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I noticed the descriptions _file_descriptors offers doesn't match what is currently presented
(only tried linux) _foo() _file_descriptors; compdef _foo foo
It happens when `list' is converted from a scalar to an array using list+=(...)
an empty string is the first element, so the two arrays `list' and `fd' aren't the same length
when compadd is used.
I also silence stderr for the loops of fds since another error happens when used:
_file_descriptors:zstat:12: /proc/18123/fd/3: no such file or directory
Completion/Zsh/Type/_file_descriptors | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Completion/Zsh/Type/_file_descriptors b/Completion/Zsh/Type/_file_descriptors
index 3e251b7..438fcc8 100644
--- a/Completion/Zsh/Type/_file_descriptors
+++ b/Completion/Zsh/Type/_file_descriptors
@@ -1,6 +1,7 @@
#autoload
-local i fds expl list link sep
+local i fds expl link sep
+local -a list
fds=( /dev/fd/<0-9>(N:t) )
@@ -20,7 +21,7 @@ if zstyle -T ":completion:${curcontext}:" verbose && [[ -h /proc/$$/fd/$fds[1] ]
for i in "${fds[@]}"; do
list+=( "$i $sep $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" )
done
- fi
+ fi 2>/dev/null
if (( $list[(I)* $sep ?*] )); then
_wanted file-descriptors expl 'file descriptor' compadd "$@" -d list -a - fds
--
2.4.2
Messages sorted by:
Reverse Date,
Date,
Thread,
Author