From eae12688c9bb056b21e4e62fc295be5ebdcb8b7b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 20 Jul 2017 16:09:31 +0200 Subject: shell: optional support for read -t N.NNN, closes 10101 function old new delta shell_builtin_read 1097 1277 +180 dump_procs 353 359 +6 Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-read/read_t0.tests | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 shell/hush_test/hush-read/read_t0.tests (limited to 'shell/hush_test/hush-read/read_t0.tests') diff --git a/shell/hush_test/hush-read/read_t0.tests b/shell/hush_test/hush-read/read_t0.tests new file mode 100755 index 000000000..6b7bc217b --- /dev/null +++ b/shell/hush_test/hush-read/read_t0.tests @@ -0,0 +1,14 @@ +# ><[0] +echo Ok | { sleep 0.1; read -t 0 reply; echo ">$reply<[$?]"; } + +# This would not be deterministic: returns 0 "data exists" if EOF is seen +# (true terminated) - because EOF is considered to be data (read will not block), +# else returns 1 "no data". +## ><[????] +#true | { read -t 0 reply; echo ">$reply<[$?]"; } + +# ><[0] +true | { sleep 0.1; read -t 0 reply; echo ">$reply<[$?]"; } + +# ><[1] +sleep 0.2 | { read -p IGNORED_PROMPT -t 0 reply; echo ">$reply<[$?]"; } -- cgit v1.2.3