From 94b55d3fa046523e13de9df1c2fb39280f4842e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 27 Apr 2011 00:57:16 +0200 Subject: [PATCH] Gracefully handle `setlocale' errors at the REPL. * module/ice-9/top-repl.scm (top-repl): Catch exceptions from `setlocale'. Reported by CRLF0710 . --- module/ice-9/top-repl.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/ice-9/top-repl.scm b/module/ice-9/top-repl.scm index 64c023997..d43436c4a 100644 --- a/module/ice-9/top-repl.scm +++ b/module/ice-9/top-repl.scm @@ -65,7 +65,14 @@ (call-with-sigint (lambda () (and (defined? 'setlocale) - (setlocale LC_ALL "")) + (catch 'system-error + (lambda () + (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))) (run-hook exit-hook) status)))))