[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#50960] [PATCH v3 09/10] cache: Gracefully handle non-existent cache
From: |
Ludovic Courtès |
Subject: |
[bug#50960] [PATCH v3 09/10] cache: Gracefully handle non-existent cache. |
Date: |
Mon, 18 Oct 2021 21:52:18 +0200 |
* guix/cache.scm (maybe-remove-expired-cache-entries): Ignore ENOENT
when writing EXPIRY-FILE.
---
guix/cache.scm | 10 ++++++++--
1 file 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 @@ (define last-expiry-date
#: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
--
2.33.0
- [bug#50960] [PATCH v2 03/11] Add 'guix shell'., (continued)
- [bug#50960] [PATCH v3 00/10] Adding 'guix shell': last call!, Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 01/10] packages: Add 'package-development-inputs'., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 06/10] environment: Skip derivation computation when '--profile' is used., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 04/10] shell: By default load the local 'guix.scm' or 'manifest.scm' file., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 02/10] profiles: Add 'package->development-manifest'., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 09/10] cache: Gracefully handle non-existent cache.,
Ludovic Courtès <=
- [bug#50960] [PATCH v3 05/10] environment: Add tests for '--profile'., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 08/10] environment: Autoload some modules., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 07/10] environment: Do not connect to the daemon when '--profile' is used., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 10/10] shell: Maintain a profile cache., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 03/10] Add 'guix shell'., Ludovic Courtès, 2021/10/18
- [bug#50960] [PATCH v3 00/10] Adding 'guix shell': last call!, zimoun, 2021/10/19
- [bug#50960] [PATCH 00/10] Add 'guix shell' to subsume 'guix environment', zimoun, 2021/10/25
- [bug#50960] [PATCH 00/10] Add 'guix shell' to subsume 'guix environment', Ludovic Courtès, 2021/10/25
- [bug#50960] [PATCH 00/10] Add 'guix shell' to subsume 'guix environment', zimoun, 2021/10/25
- [bug#50960] [PATCH 00/10] Add 'guix shell' to subsume 'guix environment', Ludovic Courtès, 2021/10/25