summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests.sh b/tests.sh
index f4d4107..d664793 100755
--- a/tests.sh
+++ b/tests.sh
@@ -510,12 +510,18 @@ function bfs_diff() (
)
function closefrom() {
- for fd in /dev/fd/*; do
+ if [ -d /proc/self/fd ]; then
+ local fds=/proc/self/fd
+ else
+ local fds=/dev/fd
+ fi
+
+ for fd in "$fds"/*; do
if [ ! -e "$fd" ]; then
continue
fi
- fd="${fd##*/}"
+ local fd="${fd##*/}"
if [ "$fd" -ge "$1" ]; then
eval "exec ${fd}<&-"
fi