Skip to content

Commit

Permalink
tests/subshell.sh: fix a test for systems without /dev/fd/*
Browse files Browse the repository at this point in the history
ksh's built-in test, [ and [[ commands treat /dev/fd/* specially:
e.g. 'test /dev/fd/0' returns true even if it doesn't physically
exist, as on e.g. HP-UX. However, external commands need it to
exist physically.

src/cmd/ksh93/tests/subshell.sh:
- To decide whether to run a test with 'tee', use external 'test'
  command to check if /dev/stdout and /dev/fd/1 actually exist.
  • Loading branch information
McDutchie committed Jul 21, 2020
1 parent bc8b36f commit 0c96f97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/ksh93/tests/subshell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ $SHELL <<- \EOF
EOF

for f in /dev/stdout /dev/fd/1
do if [[ -e $f ]]
do if "${ whence -p test; }" -e "$f"
then $SHELL -c "x=\$(command -p tee $f </dev/null 2>/dev/null)" || err_exit "$f in command substitution fails"
fi
done
Expand Down

0 comments on commit 0c96f97

Please sign in to comment.