aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-05-26 21:44:22 +0100
committerChristopher Baines <mail@cbaines.net>2021-05-26 21:44:22 +0100
commit675c52d732f504232c0764ba1f03c5c54fd47763 (patch)
tree9f785055435b6a67204da27a64a4a3c7e159028f
parentfc0353b1ad4b8401ae0caecd40f8f4103c90aa93 (diff)
downloadbuild-coordinator-675c52d732f504232c0764ba1f03c5c54fd47763.tar
build-coordinator-675c52d732f504232c0764ba1f03c5c54fd47763.tar.gz
Remove stale log files
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index c4734c9..cc88659 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -22,6 +22,7 @@
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
#:use-module (ice-9 match)
+ #:use-module (ice-9 ftw)
#:use-module (ice-9 format)
#:use-module (ice-9 exceptions)
#:use-module (ice-9 textual-ports)
@@ -344,6 +345,19 @@ port. Also, the port used can be changed by passing the --port option.\n"
(mkdir-p (dirname output-file-name))
(when (file-exists? tmp-output-file-name)
(delete-file tmp-output-file-name))
+
+ (for-each
+ (lambda (file)
+ (simple-format #t "~A: removing stale log file ~A\n"
+ uuid
+ file)
+ (delete-file (string-append (dirname output-file-name)
+ "/"
+ file)))
+ (scandir (dirname output-file-name)
+ (lambda (file)
+ (not (member file '("." ".."))))))
+
(if (if (bytevector? body)
(begin
(call-with-output-file tmp-output-file-name