about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-09-19 16:48:05 +0200
committerRalf Jung <post@ralfj.de>2025-09-19 16:48:05 +0200
commit04f6b8f99242eb61756fe294dd9d46536c1c8571 (patch)
treeab4e22a28edd4d7542e59d332fc709d7cb0cf4d0
parent2f4dfc753fd86c672aa4145940db075a8a149f17 (diff)
downloadrust-04f6b8f99242eb61756fe294dd9d46536c1c8571.tar.gz
rust-04f6b8f99242eb61756fe294dd9d46536c1c8571.zip
fix ./x readdir logic when CDPATH is set
-rwxr-xr-xx3
1 files changed, 2 insertions, 1 deletions
diff --git a/x b/x
index 551cfe6efbf..4fce0be219e 100755
--- a/x
+++ b/x
@@ -15,7 +15,8 @@ realpath() {
     if [ -L "$path" ]; then
         readlink -f "$path"
     elif [ -d "$path" ]; then
-        (cd -P "$path" && pwd)
+        # "cd" is not always silent (e.g. when CDPATH is set), so discard its output.
+        (cd -P "$path" >/dev/null && pwd)
     else
         echo "$(realpath "$(dirname "$path")")/$(basename "$path")"
     fi