From c98a28366e99947a9f62f77789885ef3ec9ab116 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 10 Dec 2024 02:40:58 -0800 Subject: [PATCH] Make rlocation in test-setup.sh compatible with /bin/sh Addressing https://github.com/bazelbuild/bazel/pull/24256#discussion_r1877753150 PiperOrigin-RevId: 704624513 Change-Id: I73ec6559a7a7b2465abd2faae0e687a97ea77db9 --- tools/test/test-setup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh index 6ee88b1cd3778d..4c9547ff70faf8 100755 --- a/tools/test/test-setup.sh +++ b/tools/test/test-setup.sh @@ -237,9 +237,11 @@ fi # Redefine rlocation to notify users of its removal - it used to be exported. # TODO: Remove this before Bazel 9. function rlocation() { - read LINE SUB FILE < <(caller 0); - >&2 echo "ERROR: rlocation is no longer implicitly provided by Bazel's test setup, but called from $SUB in line $LINE of $FILE. Please use https://github.com/bazelbuild/rules_shell/blob/main/shell/runfiles/runfiles.bash instead." - exit 1 + caller 0 | { + read LINE SUB FILE + echo >&2 "ERROR: rlocation is no longer implicitly provided by Bazel's test setup, but called from $SUB in line $LINE of $FILE. Please use https://github.com/bazelbuild/rules_shell/blob/main/shell/runfiles/runfiles.bash instead." + exit 1 + } } export -f rlocation