[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 03/07: support: Add 'display-line'.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 03/07: support: Add 'display-line'. |
Date: |
Fri, 22 Jan 2016 23:36:59 +0000 |
civodul pushed a commit to branch master
in repository shepherd.
commit 38c7dfdad6b017ff52b475ff7f399c0b1dce9600
Author: Ludovic Courtès <address@hidden>
Date: Fri Jan 22 23:03:47 2016 +0100
support: Add 'display-line'.
* modules/shepherd/support.scm (display-line): New procedure.
* modules/herd.scm (println): Remove.
(run-command): Use 'display-line' instead of 'println'.
---
modules/herd.scm | 8 ++------
modules/shepherd/support.scm | 6 ++++++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/modules/herd.scm b/modules/herd.scm
index 13f531c..c7b6449 100644
--- a/modules/herd.scm
+++ b/modules/herd.scm
@@ -83,10 +83,6 @@ of pairs."
(format #t (l10n " Will be respawned.~%"))
(format #t (l10n " Will not be respawned.~%")))))))
-(define (println message)
- (display message)
- (newline))
-
(define (run-command socket-file action service args)
"Perform ACTION with ARGS on SERVICE, and display the result. Connect to
the daemon via SOCKET-FILE."
@@ -110,7 +106,7 @@ the daemon via SOCKET-FILE."
('messages messages))
;; First, display raw messages coming from the daemon. Since they are
;; not translated in the user's locale, they should be avoided!
- (for-each println messages)
+ (for-each display-line messages)
;; Then interpret the result
(match (list action service)
@@ -133,7 +129,7 @@ the daemon via SOCKET-FILE."
(('reply ('version 0 _ ...) ;an error
('result _) ('error error)
('messages messages))
- (for-each println messages)
+ (for-each display-line messages)
(match error
(('error ('version 0 _ ...) 'service-not-found service)
(report-error (l10n "service ~a could not be found")
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 99a76bf..fbc7b3a 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -38,6 +38,7 @@
display-version
program-name
report-error
+ display-line
user-homedir
default-logfile
@@ -208,6 +209,11 @@ There is NO WARRANTY, to the extent permitted by law.")))
#'(format (current-error-port) message
(program-name) args ...))))))
+(define* (display-line message #:optional (port (current-output-port)))
+ "Display MESSAGE followed by a newline to PORT."
+ (display message port)
+ (newline port))
+
;; Home directory of the user.
- [shepherd] branch master updated (852341e -> 28ed7e1), Ludovic Courtès, 2016/01/22
- [shepherd] 01/07: herd: Report errors according to the GNU standards., Ludovic Courtès, 2016/01/22
- [shepherd] 03/07: support: Add 'display-line'.,
Ludovic Courtès <=
- [shepherd] 04/07: comm: Add 'report-command-error'., Ludovic Courtès, 2016/01/22
- [shepherd] 05/07: reboot, halt: Adjust to sexp replies., Ludovic Courtès, 2016/01/22
- [shepherd] 07/07: Rename 'dmd-output-port' to 'shepherd-output-port'., Ludovic Courtès, 2016/01/22
- [shepherd] 02/07: Move 'report-error' to (shepherd support)., Ludovic Courtès, 2016/01/22
- [shepherd] 06/07: shepherd: Ignore SIGPIPE., Ludovic Courtès, 2016/01/22