Handle eof when reading logs

This commit is contained in:
Christopher Baines 2023-11-05 18:49:11 +00:00
parent b026b8795b
commit 341eb4a283

View file

@ -72,6 +72,9 @@ VALUES (nextval('" (log-part-sequence-name job_id) "'), $1, $2)")
(list job-id))
(let loop ((line (get-line port-to-read-from)))
(if (eof-object? line)
(simple-format #t "finished reading logs for ~A\n"
job-id)
(let ((line-with-newline
(string-append line "\n")))
(catch #t
@ -97,8 +100,8 @@ error: could not insert log part: '~A'\n\n"
guix-data-service: error: missing log line: ~A
\n" key)))
(lambda _
#t)))))
(loop (get-line port-to-read-from)))))))
#t))))
(loop (get-line port-to-read-from)))))))))
port-to-write-to)))