summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-10-01 23:12:09 +0200
committerLudovic Courtès <ludo@gnu.org>2021-10-25 19:02:33 +0200
commit2cb0b3709ace41078872578f657ab0ee45d20ac9 (patch)
treeb2fa9c2ee2da71960f8eb38f665cf940d63c88b9
parent3c96158438e3a813fb98f0eba78ee5c3ae93f065 (diff)
downloadguix-2cb0b3709ace41078872578f657ab0ee45d20ac9.tar.gz
cache: Gracefully handle non-existent cache.
* guix/cache.scm (maybe-remove-expired-cache-entries): Ignore ENOENT
when writing EXPIRY-FILE.
-rw-r--r--guix/cache.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/guix/cache.scm b/guix/cache.scm
index 0401a9d428..51009809bd 100644
--- a/guix/cache.scm
+++ b/guix/cache.scm
@@ -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