Skip to content

Commit

Permalink
apt-cache: avoid nonzero exit code from _apt_cache_packages
Browse files Browse the repository at this point in the history
On systems where apt-cache is not available but we attempt an apt-get
command that does "_xfunc apt-cache _apt_cache_packages" (no matter if
apt-get is installed) to add to some populated completions in COMPREPLY,
for some reason the failure empties whatever is in COMPREPLY even though
we're using +=. Current apt-get build-dep completion is an example of
this on e.g. CentOS 6 which has neither apt-get or apt-cache, dirs
should be completed even though apt-cache is not there. Haven't
investigated why, but this works around it.
  • Loading branch information
scop committed May 9, 2020
1 parent 033f548 commit ea97386
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion completions/apt-cache
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# List APT binary packages
_apt_cache_packages()
{
apt-cache --no-generate pkgnames "$cur" 2>/dev/null
apt-cache --no-generate pkgnames "$cur" 2>/dev/null || :
}

# List APT source packages
Expand Down

0 comments on commit ea97386

Please sign in to comment.