summaryrefslogtreecommitdiff
path: root/guix/scripts/shell.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2021-11-08 09:06:14 +0200
committerEfraim Flashner <efraim@flashner.co.il>2021-11-08 09:06:14 +0200
commit1c94392a13cbdf87e03a644633eb775bf45694a1 (patch)
tree74f11038dfc5f9d9db06660b1087253b28c5434f /guix/scripts/shell.scm
parentdd87bbb2b78b279248aaff15c0706fcd6d8cd7bb (diff)
parent9d25ee30b188f9202cc14f7cd25ba8a1c3ec1a72 (diff)
downloadguix-patches-1c94392a13cbdf87e03a644633eb775bf45694a1.tar
guix-patches-1c94392a13cbdf87e03a644633eb775bf45694a1.tar.gz
Merge remote-tracking branch 'origin/master' into core-updates-frozen
Diffstat (limited to 'guix/scripts/shell.scm')
-rw-r--r--guix/scripts/shell.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm
index 5749485a44..bd62803cb1 100644
--- a/guix/scripts/shell.scm
+++ b/guix/scripts/shell.scm
@@ -387,8 +387,14 @@ echo ~a >> ~a
(display-hint (G_ "Consider passing the @option{--check} option once
to make sure your shell does not clobber environment variables."))) )
- (let ((result (guix-environment* opts)))
- (maybe-remove-expired-cache-entries (%profile-cache-directory)
- cache-entries
- #:entry-expiration entry-expiration)
- result))
+ ;; Clean the cache in EXIT-HOOK so that (1) it happens after potential use
+ ;; of cached profiles, and (2) cleanup actually happens, even when
+ ;; 'guix-environment*' calls 'exit'.
+ (add-hook! exit-hook
+ (lambda _
+ (maybe-remove-expired-cache-entries
+ (%profile-cache-directory)
+ cache-entries
+ #:entry-expiration entry-expiration)))
+
+ (guix-environment* opts))