diff options
author | 2020-02-28 19:46:24 -0500 | |
---|---|---|
committer | 2020-02-29 17:00:00 -0500 | |
commit | a4c6e0989d1233ba475b0b890d9d084b113682be (patch) | |
tree | 5d958662d4f936b117a6ba8c0da88e9e86615f8d | |
parent | respect ROOT env variable (diff) | |
download | eselect-php-a4c6e0989d1233ba475b0b890d9d084b113682be.tar.gz eselect-php-a4c6e0989d1233ba475b0b890d9d084b113682be.tar.bz2 eselect-php-a4c6e0989d1233ba475b0b890d9d084b113682be.zip |
src/php.eselect.in.in: enable nullglob during find_targets().
While it didn't appear to hurt anything, the find_targets() function
could output a literal "php*.*" when there were no valid PHP targets.
Now the "nullglob" shell option is enabled during that function.
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
-rw-r--r-- | src/php.eselect.in.in | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in index a047c62..12ef1e1 100644 --- a/src/php.eselect.in.in +++ b/src/php.eselect.in.in @@ -246,10 +246,12 @@ update_sapi() { # A space-separated list of target names, for example, "php5.6 php7.0". # find_targets() { - # TODO: when there aren't any phpX.Y directories, this returns - # "php*.*". This doesn't seem to bother our consumers, but it - # would probably be more polite to return nothing in that case. + # Temporarily enable the "nullglob" shell option to ensure that we + # don't return a literal "php*.*" when there are no valid targets. + local shopt_nullglob_saved=$(shopt -p nullglob) + shopt -s nullglob cd "${ROOT%/}@LIBDIR@" && echo php*.* + ${shopt_nullglob_saved} } # List all valid targets for the given SAPI. The list is obtained by |