From 473b03b3c6fbca909e18dbb5888ac5a98992207a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 29 Jan 2013 23:59:27 +0100 Subject: 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 ""). --- guix/ui.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'guix') 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 -- cgit v1.2.3