Skip to content

Commit 67d3881

Browse files
authored
Unrolled build for #146777
Rollup merge of #146777 - RalfJung:x-cdpath, r=Kobzol fix ./x readdir logic when CDPATH is set Fixes #146769 r? ``@Kobzol``
2 parents 0be8e16 + 04f6b8f commit 67d3881

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

x

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ realpath() {
1515
if [ -L "$path" ]; then
1616
readlink -f "$path"
1717
elif [ -d "$path" ]; then
18-
(cd -P "$path" && pwd)
18+
# "cd" is not always silent (e.g. when CDPATH is set), so discard its output.
19+
(cd -P "$path" >/dev/null && pwd)
1920
else
2021
echo "$(realpath "$(dirname "$path")")/$(basename "$path")"
2122
fi

0 commit comments

Comments
 (0)