summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-12-19 09:31:46 +0100
committerLudovic Courtès <ludo@gnu.org>2025-12-22 15:10:52 +0100
commit5d6dfd8981ac9ab65012de0e9a9ed26301e5b8fd (patch)
tree0dd35f8a93688c724dad50d048fdd49e50a98216
parentce279acd14fba2dfca17a25d7733838df9103dcb (diff)
authenticate: Improve error replies.
* guix/scripts/authenticate.scm (guix-authenticate)[send-reply]: Wrap guard in ‘with-fluids’. Call ‘string-trim-right’ on the message string of ‘c’. Change-Id: I6ab5f645f2dc9d6f53bb57eabb4de1df8212892f Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/scripts/authenticate.scm12
1 files changed, 8 insertions, 4 deletions
diff --git a/guix/scripts/authenticate.scm b/guix/scripts/authenticate.scm
index 45f62f6ebc2..48e76c61c8a 100644
--- a/guix/scripts/authenticate.scm
+++ b/guix/scripts/authenticate.scm
@@ -161,10 +161,14 @@ by colon, followed by the given number of characters."
161 ;; Send a reply for the result of THUNK or for any exception raised during 161 ;; Send a reply for the result of THUNK or for any exception raised during
162 ;; its execution. 162 ;; its execution.
163 (guard (c ((formatted-message? c) 163 (guard (c ((formatted-message? c)
164 (send-reply (reply-code command-failed) 164 ;; Make sure the translated message can be written to standard
165 (apply format #f 165 ;; output as ISO-8859-1 no matter what (XXX).
166 (G_ (formatted-message-string c)) 166 (with-fluids ((%default-port-conversion-strategy 'substitute))
167 (formatted-message-arguments c))))) 167 (send-reply (reply-code command-failed)
168 (apply format #f
169 (string-trim-right
170 (G_ (formatted-message-string c)))
171 (formatted-message-arguments c))))))
168 (send-reply (reply-code success) (thunk)))) 172 (send-reply (reply-code success) (thunk))))
169 173
170 (define-syntax-rule (with-reply exp ...) 174 (define-syntax-rule (with-reply exp ...)