cache: Gracefully handle non-existent cache.

* guix/cache.scm (maybe-remove-expired-cache-entries): Ignore ENOENT
when writing EXPIRY-FILE.
This commit is contained in:
Ludovic Courtès 2021-10-01 23:12:09 +02:00
parent 3c96158438
commit 2cb0b3709a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

@ -101,7 +101,13 @@ CLEANUP-PERIOD denotes the minimum time between two cache cleanups."
#:now now
#:entry-expiration entry-expiration
#:delete-entry delete-entry)
(call-with-output-file expiry-file
(cute write (time-second now) <>))))
(catch 'system-error
(lambda ()
(call-with-output-file expiry-file
(cute write (time-second now) <>)))
(lambda args
;; ENOENT means CACHE does not exist.
(unless (= ENOENT (system-error-errno args))
(apply throw args))))))
;;; cache.scm ends here