1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

Gracefully handle `setlocale' errors at the REPL.

* module/ice-9/top-repl.scm (top-repl): Catch exceptions from
  `setlocale'.  Reported by CRLF0710 <crlf0710@gmail.com>.
This commit is contained in:
Ludovic Courtès 2011-04-27 00:57:16 +02:00
parent fb9cfa83a7
commit 94b55d3fa0

View file

@ -65,7 +65,14 @@
(call-with-sigint (call-with-sigint
(lambda () (lambda ()
(and (defined? 'setlocale) (and (defined? 'setlocale)
(catch 'system-error
(lambda ()
(setlocale LC_ALL "")) (setlocale LC_ALL ""))
(lambda (key subr fmt args errno)
(format (current-error-port)
"warning: failed to install locale: ~a~%"
(strerror (car errno))))))
(let ((status (start-repl 'scheme))) (let ((status (start-repl 'scheme)))
(run-hook exit-hook) (run-hook exit-hook)
status))))) status)))))