mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-12 13:10:45 +02:00
read builtin timeouts no longer use SIGALRM
This commit is contained in:
@@ -66,8 +66,6 @@ case " " in ( [" "] ) echo ok;; ( * ) echo no;; esac
|
||||
case esac in (esac) echo esac;; esac
|
||||
case k in else|done|time|esac) for f in 1 2 3 ; do :; done esac
|
||||
|
||||
|
||||
|
||||
# tests of quote removal and pattern matching
|
||||
${THIS_SH} ./case1.sub
|
||||
${THIS_SH} ./case2.sub
|
||||
|
||||
+2
-1
@@ -39,9 +39,10 @@ timeout 2: ok
|
||||
unset or null 2
|
||||
timeout 3: ok
|
||||
unset or null 3
|
||||
./read2.sub: line 43: read: -3: invalid timeout specification
|
||||
./read2.sub: line 45: read: -3: invalid timeout specification
|
||||
1
|
||||
|
||||
abcde
|
||||
abcde
|
||||
./read3.sub: line 17: read: -1: invalid number
|
||||
abc
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
: ${TMPDIR:=/var/tmp}
|
||||
|
||||
a=4
|
||||
|
||||
read -t 1 a < /dev/tty
|
||||
@@ -50,3 +52,21 @@ echo abcde | {
|
||||
read -t 0.5 a
|
||||
echo $a
|
||||
}
|
||||
|
||||
read -t .0001 a <<<abcde
|
||||
echo $a
|
||||
|
||||
# this is the original test that prompted the change to sh_timers
|
||||
cd $TMPDIR
|
||||
rm -f a.pipe
|
||||
mkfifo a.pipe
|
||||
exec 9<> a.pipe
|
||||
rm -f a.pipe
|
||||
|
||||
for c in {0..2000}; do
|
||||
(eval "echo {0..$c}" & read -u 9 -t 0.0001) >/dev/null
|
||||
printf $'ok %d' "$c" >/dev/null
|
||||
done
|
||||
|
||||
cd $OLDPWD
|
||||
rm -f $TMPDIR/a.pipe # paranoia
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@
|
||||
#
|
||||
# test behavior of native readline timeouts
|
||||
|
||||
read -t 0.001 -e var
|
||||
read -t 0.00001 -e var
|
||||
estat=$?
|
||||
if [ $estat -gt 128 ]; then
|
||||
echo timeout 1: ok
|
||||
@@ -40,7 +40,7 @@ else
|
||||
fi
|
||||
echo ${var:-unset or null 3}
|
||||
|
||||
sleep 2 | read -t 1 -e a
|
||||
sleep 1 | read -t 0.25 -e a
|
||||
estat=$?
|
||||
if [ $estat -gt 128 ]; then
|
||||
echo timeout 4: ok
|
||||
@@ -50,6 +50,6 @@ fi
|
||||
|
||||
# the above should all time out
|
||||
echo abcde | {
|
||||
read -e -t 2 a
|
||||
read -e -t 0.5 a
|
||||
echo $a
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user