dmd/compiler/test/tools/common_funcs.sh
2022-07-09 18:53:07 +02:00

15 lines
341 B
Bash

# rm with retry
# Useful to workaround a race condition on windows when removing executables
# that were just running.
function rm_retry {
local attempt=1
for true; do
rm -f $@ && break
if [ $attempt -ge 4 ]; then
return 1
fi
let attempt=attempt+=1
sleep 1
done
return 0
}