From 675c52d732f504232c0764ba1f03c5c54fd47763 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 26 May 2021 21:44:22 +0100 Subject: Remove stale log files --- guix-build-coordinator/agent-messaging/http/server.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 -- cgit v1.2.3