Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Cygwin spawn wait deadlock test.
- # (C) John Peterson. License GNU GPL 3.
- function logb() { printf "\033[1;30m$1%s\033[0m"; }
- function logc() { printf "\033[0;36m$1%s\033[0m"; }
- function iscygwin() {
- if [ -n "`objdump -p ./readm.exe|grep cygwin1.dll`" ]; then echo true; else echo false; fi
- }
- if $(iscygwin); then printf "readm must be non-cygwin process. please build with mingw.) \n"; exit 0; fi
- function time_s() {
- echo -n `date +%s`
- }
- logb "Running pgrep repeatedly. If the counter stops it\'s deadlocked. (Terminate pgrep with \'taskkill /f /im pgrep.exe\' to end the loop.)\n"
- { n=0; t=$(time_s); while :; do
- logc "`printf "\r\033[Kpgrep bash %d" $i`"
- pgrep bash>/dev/null
- if [ $(($(time_s)-2)) -gt $t ]; then logb "`printf "\nexit from deadlock\n"`"; break; fi
- t=$(time_s)
- ((i++))
- done; }|./readm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement