forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
read builtin: Empty variables on timeout
This matches how a non-timeout error is handled. Reviewed by: jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31876
- Loading branch information
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
set -e | ||
|
||
v=original_value | ||
r=0 | ||
read v < /dev/null || r=$? | ||
[ "$r" -eq 1 ] | ||
[ -z "$v" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
set -e | ||
|
||
T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) | ||
trap 'rm -rf "$T"' 0 | ||
cd $T | ||
mkfifo fifo1 | ||
# Open fifo1 for writing and then read block on a dummy fifo | ||
{ mkfifo fifo2; read dummy <fifo2; } >fifo1 & | ||
# Wait for the child to open fifo1 for writing | ||
exec 3<fifo1 | ||
v=original_value | ||
r=0 | ||
read -t 0 v <&3 || r=$? | ||
kill -TERM "$!" || : | ||
{ [ "$r" -gt 128 ] && [ "$(kill -l "$r")" = ALRM ]; } || exit | ||
[ -z "$v" ] |