mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
ui: Report file names in 'system-error' exceptions from 'execlp'.
Fixes <https://bugs.gnu.org/33755>. * guix/ui.scm (apply-formals): New macro. (execlp): New error-reporting wrapper. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
83d4da1211
commit
6616a35202
1 changed files with 10 additions and 3 deletions
13
guix/ui.scm
13
guix/ui.scm
|
@ -502,14 +502,19 @@ (define (augmented-system-error-handler file)
|
|||
(list (strerror (car errno)) file)
|
||||
(list errno))))
|
||||
|
||||
(define-syntax-rule (error-reporting-wrapper proc (args ...) file)
|
||||
(define-syntax apply-formals
|
||||
(syntax-rules ()
|
||||
((_ proc (args ...)) (proc args ...))
|
||||
((_ proc (arg1 args ... . rest)) (apply proc arg1 args ... rest))))
|
||||
|
||||
(define-syntax-rule (error-reporting-wrapper proc formals file)
|
||||
"Wrap PROC such that its 'system-error' exceptions are augmented to mention
|
||||
FILE."
|
||||
(let ((real-proc (@ (guile) proc)))
|
||||
(lambda (args ...)
|
||||
(lambda formals
|
||||
(catch 'system-error
|
||||
(lambda ()
|
||||
(real-proc args ...))
|
||||
(apply-formals real-proc formals))
|
||||
(augmented-system-error-handler file)))))
|
||||
|
||||
(set! symlink
|
||||
|
@ -528,6 +533,8 @@ (define-syntax-rule (error-reporting-wrapper proc (args ...) file)
|
|||
(set! delete-file
|
||||
(error-reporting-wrapper delete-file (file) file))
|
||||
|
||||
(set! execlp
|
||||
(error-reporting-wrapper execlp (filename . args) filename))
|
||||
|
||||
(define (make-regexp* regexp . flags)
|
||||
"Like 'make-regexp' but error out if REGEXP is invalid, reporting the error
|
||||
|
|
Loading…
Reference in a new issue