diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-01-29 23:59:27 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-01-30 00:09:32 +0100 |
commit | 473b03b3c6fbca909e18dbb5888ac5a98992207a (patch) | |
tree | f193b7488453c4794f67c1bec157807788af42f8 /guix/ui.scm | |
parent | bdcf35a6b294c1db7ce78a5550ba51e067863069 (diff) | |
download | gnu-guix-473b03b3c6fbca909e18dbb5888ac5a98992207a.tar gnu-guix-473b03b3c6fbca909e18dbb5888ac5a98992207a.tar.gz |
Gracefully handle failure to install the current locale.
* guix/ui.scm (install-locale): New procedure.
* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
guix-package.in: Use it instead of (setlocale LC_ALL "").
Diffstat (limited to 'guix/ui.scm')
-rw-r--r-- | guix/ui.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 761b1ce444..3ec7be771b 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -26,6 +26,7 @@ #:use-module (ice-9 match) #:export (_ N_ + install-locale leave show-version-and-exit show-bug-report-information @@ -45,6 +46,16 @@ (define _ (cut gettext <> %gettext-domain)) (define N_ (cut ngettext <> <> <> %gettext-domain)) +(define (install-locale) + "Install the current locale settings." + (catch 'system-error + (lambda _ + (setlocale LC_ALL "")) + (lambda args + (format (current-error-port) + (_ "warning: failed to install locale: ~a~%") + (strerror (system-error-errno args)))))) + (define-syntax-rule (leave fmt args ...) "Format FMT and ARGS to the error port and exit." (begin |