chmod +x ${SUBF}
cat > ${SUBF} <<- EOF
#!/bin/bash -e
+ set -x
while true; do
if strings screenlog.0 | grep -m 1 "\${1}"; then
exit 0
sleep 0.5s
done
EOF
+ cat ${SUBF}
timeout -k 3s ${T} ${SUBF} "${1}"
local RES=$?
rm -f ${SUBF}
sudo apt-get install -y screen
screen --version | grep 'Screen version'
fi
+if ! timeout --version; then
+ # Install coreutils for the timeout command
+ sudo apt-get update -qq -y
+ sudo apt-get install -y coreutils
+ timeout --version
+fi
# Initial cleanup
-pkill 'screen' || true
+pkill -f 'screen -L -S sonemu' || true
screen -wipe || true
rm -f screenlog.0