Delete empty log files

This prevents "bashbrew/logs/latest/list-.....".
This commit is contained in:
Tianon Gravi 2015-03-04 17:09:01 -07:00
parent 081a9194bb
commit 22a64a3e89
1 changed files with 6 additions and 1 deletions

View File

@ -270,7 +270,8 @@ while [ "$#" -gt 0 ]; do
thisLog="$logDir/$subcommand-$repoTag.log"
touch "$thisLog"
ln -sf "$thisLog" "$latestLogDir/$(basename "$thisLog")"
thisLogSymlink="$latestLogDir/$(basename "$thisLog")"
ln -sf "$thisLog" "$thisLogSymlink"
case "$subcommand" in
build)
@ -373,6 +374,10 @@ while [ "$#" -gt 0 ]; do
done
;;
esac
if [ ! -s "$thisLog" ]; then
rm "$thisLog" "$thisLogSymlink"
fi
done
[ -z "$didFail" ]