[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] branch main updated: shepherd: Load config file as UTF-8 by d
From: |
Ludovic Courtès |
Subject: |
[shepherd] branch main updated: shepherd: Load config file as UTF-8 by default. |
Date: |
Sun, 24 Nov 2024 17:15:04 -0500 |
This is an automated email from the git hooks/post-receive script.
civodul pushed a commit to branch main
in repository shepherd.
The following commit(s) were added to refs/heads/main by this push:
new ff93d09 shepherd: Load config file as UTF-8 by default.
ff93d09 is described below
commit ff93d09a78fa3bd4c26ab129ed2cee6ba92cf81d
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Nov 23 15:49:44 2024 +0100
shepherd: Load config file as UTF-8 by default.
* modules/shepherd/support.scm (primitive-load*): Add call to
‘set-port-encoding!’.
* tests/basic.sh: Test it.
Reported-by: Tomas Volf <~@wolfsden.cz>
---
modules/shepherd/support.scm | 4 ++++
tests/basic.sh | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 22c60d4..6522b76 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -502,6 +502,10 @@ which has essential bindings pulled in."
;; continuation barrier that would prevent code in FILE from suspending.
(call-with-port (open file (logior O_CLOEXEC O_RDONLY))
(lambda (port)
+ ;; Honor the "-*- coding: xyz -*-" cookie if any, read as UTF-8
+ ;; otherwise.
+ (set-port-encoding! port (or (file-encoding port) "UTF-8"))
+
(let loop ((result *unspecified*))
(match (read port)
((? eof-object?)
diff --git a/tests/basic.sh b/tests/basic.sh
index d1d0041..97e396f 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -210,7 +210,7 @@ mkdir -p "$confdir"
cat > "$confdir/some-conf.scm" <<EOF
(register-services
(service '(test-loaded) ;passing a rest list, which is deprecated
- #:start (const 'abc)
+ #:start (λ _ (display "Greek letter λ\n") 'abc)
#:stop (const #f)))
EOF
@@ -229,6 +229,7 @@ $herd status test-loaded | grep stopped
$herd start test-loaded
$herd status test-loaded | grep -i 'running.*abc'
+grep "Greek letter" "$log"
$herd stop test-loaded
$herd unload root test-loaded
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [shepherd] branch main updated: shepherd: Load config file as UTF-8 by default.,
Ludovic Courtès <=