diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-04-23 19:43:59 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-04-23 19:43:59 +0200 |
commit | 37da4fbe1562583589eeddb4be8e11bece80fd35 (patch) | |
tree | 4d8a454b27e62f9b8d7b0fe641a9f6aa6de2402c /gnu/installer/utils.scm | |
parent | 73326e742d82b6706333885eca770f7518636b1f (diff) | |
parent | e01bd1a67447c1f2a2b5b03e8ea8fbbccd2cd5bd (diff) | |
download | guix-37da4fbe1562583589eeddb4be8e11bece80fd35.tar.gz |
Merge branch 'master' into staging
Diffstat (limited to 'gnu/installer/utils.scm')
-rw-r--r-- | gnu/installer/utils.scm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm index e91f90a84d..256722729c 100644 --- a/gnu/installer/utils.scm +++ b/gnu/installer/utils.scm @@ -54,9 +54,21 @@ number. If no percentage is found, return #f" (and result (string->number (match:substring result 1))))) -(define (run-shell-command command) +(define* (run-shell-command command #:key locale) + "Run COMMAND, a string, with Bash, and in the given LOCALE." (call-with-temporary-output-file (lambda (file port) + (when locale + (let ((supported? (false-if-exception + (setlocale LC_ALL locale)))) + ;; If LOCALE is not supported, then set LANGUAGE, which might at + ;; least give us translated messages. + (if supported? + (format port "export LC_ALL=\"~a\"~%" locale) + (format port "export LANGUAGE=\"~a\"~%" + (string-take locale + (string-index locale #\_)))))) + (format port "~a~%" command) ;; (format port "exit~%") (close port) |