]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/__init__.py
Fix bugs with new reporting code.
[wizard.git] / wizard / command / __init__.py
index 02ea9e3d92d1248625eb6a7f222a60c3a20ab653..fc5832a77bc7e8398b273b54c1a0800a4d93f86f 100644 (file)
@@ -134,8 +134,15 @@ def open_reports(log_dir, names=('warnings', 'errors')):
     # must not be on AFS, since subprocesses won't be
     # able to write to the logfiles do the to the AFS patch.
     files = [os.path.join(os.path.join(log_dir, "%s.txt" % x)) for x in names]
+    old_reports = os.path.join(log_dir, "old-reports")
+    rundir = os.path.join(old_reports, "run")
+    if not os.path.exists(old_reports):
+        os.mkdir(old_reports)
+    else:
+        util.safe_unlink(rundir)
     for f in files:
-        util.safe_unlink(f)
+        if os.path.exists(f):
+            os.rename(f, rundir)
     return (open(f, "w") for f in files)
 
 class NullLogHandler(logging.Handler):