mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-26 06:18:07 -05:00
syscalls: 'with-file-lock' removes lock file upon exit.
Fixes <https://issues.guix.gnu.org/57501>. Reported by Ricardo Wurmus <rekado@elephly.net>. * guix/build/syscalls.scm (call-with-file-lock) (call-with-file-lock/no-wait): Add call to 'delete-file' in unwind handler.
This commit is contained in:
parent
89c5cb4078
commit
a68229b9a0
1 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2014-2023 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
||||
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
||||
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||
|
@ -1400,7 +1400,8 @@ (define (call-with-file-lock file thunk)
|
|||
thunk
|
||||
(lambda ()
|
||||
(when port
|
||||
(unlock-file port))))))
|
||||
(unlock-file port)
|
||||
(delete-file file))))))
|
||||
|
||||
(define (call-with-file-lock/no-wait file thunk handler)
|
||||
(let ((port #f))
|
||||
|
@ -1428,7 +1429,8 @@ (define (call-with-file-lock/no-wait file thunk handler)
|
|||
thunk
|
||||
(lambda ()
|
||||
(when port
|
||||
(unlock-file port))))))
|
||||
(unlock-file port)
|
||||
(delete-file file))))))
|
||||
|
||||
(define-syntax-rule (with-file-lock file exp ...)
|
||||
"Wait to acquire a lock on FILE and evaluate EXP in that context."
|
||||
|
|
Loading…
Reference in a new issue