[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 04/05: comm: ‘make-shepherd-output-port’ uses suspendable ‘pu
From: |
Ludovic Courtès |
Subject: |
[shepherd] 04/05: comm: ‘make-shepherd-output-port’ uses suspendable ‘put-string’. |
Date: |
Sat, 20 Jul 2024 17:19:52 -0400 (EDT) |
civodul pushed a commit to branch wip-syslogd
in repository shepherd.
commit 9b65c008da12e34d1f18078028e7243885d8b910
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Jul 20 23:00:41 2024 +0200
comm: ‘make-shepherd-output-port’ uses suspendable ‘put-string’.
‘display’ is not suspendable as of Guile 3.0.10 so use ‘put-string’
instead.
* modules/shepherd/comm.scm (make-shepherd-output-port): Use
‘put-string’ instead of ‘display’.
---
modules/shepherd/comm.scm | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules/shepherd/comm.scm b/modules/shepherd/comm.scm
index 0051dbc..ef04074 100644
--- a/modules/shepherd/comm.scm
+++ b/modules/shepherd/comm.scm
@@ -23,6 +23,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (ice-9 match)
+ #:autoload (ice-9 textual-ports) (put-string)
#:export (open-connection
open-server-socket
@@ -317,7 +318,7 @@ mechanism."
;; One character for output.
(lambda (char)
- (display (string char)))
+ (put-string original-output-port (string char)))
;; A string for output.
(let ((buffer '())) ;; List of unwritten output strings.
@@ -326,8 +327,8 @@ mechanism."
;; unlikely case nobody is listening, send to the standard output.
(if (%current-client-socket)
(catch-system-error
- (display str (%current-client-socket)))
- (display str original-output-port))
+ (put-string (%current-client-socket) str))
+ (put-string original-output-port str))
;; Logfile, buffer line-wise and output time for each
;; completed line.
@@ -340,9 +341,9 @@ mechanism."
(let* ((index (string-index str #\newline))
(line (if index (string-take str (+ 1 index)) str)))
(unless (string-null? str)
- ;; Make exactly one 'display' call per line to make sure we
- ;; don't create several entries for each line.
- (display line (log-output-port))
+ ;; Make exactly one 'put-string' call per line to make
+ ;; sure we don't create several entries for each line.
+ (put-string (log-output-port) line)
(when index
(loop (string-drop str (+ index 1)))))))