check outfile exists first and use stat for size check

Co-authored-by: packetzero <20775507+packetzero@users.noreply.github.com>
This commit is contained in:
ketumbra
2022-09-30 22:20:59 +01:00
committed by GitHub
parent 53e53525a8
commit 52d550c2b3
+5 -3
View File
@@ -24,9 +24,11 @@ osascript -e '
' "${OUTPATH}" ${DURSEC}
# check file is created and a decent size (empty recording is still ~62KB)
RECSIZE=`cat ${OUTPATH} | wc -c`
if [ $RECSIZE -gt 100000 ]; then
echo "Audio data present" && exit 0
if [ -f "${OUTPATH}" ] ; then
RECSIZE=`stat -f '%z' ${OUTPATH}`
if [ $RECSIZE -gt 100000 ]; then
echo "Audio data present" && exit 0
fi
fi
echo "Failed"
exit 1