-
-
Save ilatypov/2d8d8043ef6592ebd6064906b773c6c7 to your computer and use it in GitHub Desktop.
Demo the unstable bash 4.3.42 trap in the 64-bit Cygwin (cygwin1.dll of April 21, 2016, size 3539372) on Windows 7 Enterprise SP1
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
#! /bin/bash | |
set -e | |
function fun() { | |
echo fun called | |
} | |
trap ' | |
err=$? | |
trap - HUP INT TERM EXIT ERR | |
# changing - to "" above stabilizes the trap | |
echo starting a trap loop | |
for ((i=0; i<10; i++)) ; do | |
echo trap loop | |
fun | |
sleep 1 | |
done | |
exit $err | |
' HUP INT TERM EXIT ERR | |
while : ; do : ; done | |
# $ timeout 2s ./t.sh | |
# starting a trap loop | |
# trap loop | |
# fun called | |
# | |
# $ timeout 2s ./t.sh | |
# starting a trap loop | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called | |
# trap loop | |
# fun called |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm just observed a "warning" when testing trap "",