Skip to content

Commit eea2496

Browse files
mbakkezx2c4
authored andcommitted
Ensure compatibility with tree 2.0
Tree 2.0 and later will unconditionally ignore all options and write JSON data on file descriptor 3 when available, which causes problems for the test harness and other scripts that use FD 3. Work around by closing descriptor 3 for the 'tree' command.
1 parent 04cd302 commit eea2496

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/password-store.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ cmd_show() {
402402
else
403403
echo "${path%\/}"
404404
fi
405-
tree -N -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors
405+
tree -N -C -l --noreport "$PREFIX/$path" 3>&- | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors
406406
elif [[ -z $path ]]; then
407407
die "Error: password store is empty. Try \"pass init\"."
408408
else
@@ -414,7 +414,7 @@ cmd_find() {
414414
[[ $# -eq 0 ]] && die "Usage: $PROGRAM $COMMAND pass-names..."
415415
IFS="," eval 'echo "Search Terms: $*"'
416416
local terms="*$(printf '%s*|*' "$@")"
417-
tree -N -C -l --noreport -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
417+
tree -N -C -l --noreport -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" 3>&- | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
418418
}
419419

420420
cmd_grep() {

0 commit comments

Comments
 (0)