Improve handling of errors when changing locale

In the load-new-guix-revision module.
This commit is contained in:
Christopher Baines 2019-09-01 12:35:10 +01:00
parent 3a79449974
commit f118ed0bf9

View file

@ -265,14 +265,22 @@ WHERE job_id = $1"
(messages-by-locale
(filter-map
(lambda (locale)
(setlocale LC_MESSAGES locale)
(catch 'system-error
(lambda ()
(setlocale LC_MESSAGES locale))
(lambda (key . args)
(error
(simple-format
#f
"error changing locale to ~A: ~A ~A"
locale key args))))
(let ((message
(lint-warning-message lint-warning)))
(setlocale LC_MESSAGES source-locale)
(if (string=? message source-message)
#f
(cons locale message))))
(list ,@locales))))
(setlocale LC_MESSAGES "")
(cons (cons source-locale source-message)
messages-by-locale))))
(check package))))