From 63230a1ae338b6a88be0e9c2a6e43b6f10d456dd Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 2 Mar 2019 03:45:35 -0500 Subject: [PATCH] builder.py: atomically replace the log for a given target. Previously we were truncating the log if it existed. This would cause redo-log to produce invalid output if you had the following (admittedly rare) sequence in a single session: - start building X - redo-log starts showing the log for X - finish building X - redo-log has not finished showing the log for X yet - start building X again for some reason - redo-log sees a truncated logfile. Now, redo-log can finish reading the original file (which no longer has a filename since it was overwritten) while the new file is being created. --- bin/all.do | 2 +- redo/builder.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/all.do b/bin/all.do index 4d41446..e96e00d 100644 --- a/bin/all.do +++ b/bin/all.do @@ -1,3 +1,3 @@ exec >&2 -redo-ifchange ../redo/version/all ../redo/py list redo-sh +redo-ifchange ../redo/version/all ../redo/py ../redo/sh list xargs redo-ifchange