Hi Guix,
Lately I've been a bit annoyed by messages from the home shepherd when
logging in trough a tty.
The shepherd help output advertises --silent/--quiet options to not
output to stdout but looking through the shepherd repository this
options are doing nothing.
The other day I was able to hack something together which from limited
testing seems to make those options work (with a corresponding patch to
add --silent to the home-shepherd launch script). I have attached my
surprisingly simple diff (which applies on top of devel branch).
It was not clear to me weather boolean variables should be suffixed
wirth "?". When it got removed in [1] a long time ago it was unsuffixed.
I have tested the patched devel shepherd and a similar diff on top of
0.10.5 and seems to work as I expect it: The output to stdout is no
longer there but still available in the shepherd log file.
Slightly related I noticed an issue with the devel shepherd invoked via
guix home not daemonizing blocking my login manager.
I hope this useful for someone else as well.
Dariqq
[1]
https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=e86cfe28c14d734fe917e4935d72e7ad2cc9b299diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 6051ffa..52bd526 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -493,6 +493,10 @@ If @code{-} is specified as file name, commands will be read from
standard input, one per line, as would be passed on a @command{herd}
command line (@pxref{Invoking herd}).
+@item -S
+@itemx --silent
+Don't do output to stdout.
+
@item --quiet
Synonym for @code{--silent}.
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 8f1d727..7e8c68c 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -384,6 +384,7 @@ (define (main . args)
(socket-file default-socket-file)
(pid-file #f)
(secure #t)
+ (silent? #f)
(logfile #f))
;; Process command line arguments.
(process-args (program-name) args
@@ -395,15 +396,13 @@ (define (main . args)
#:takes-argument? #f
#:description (l10n "synonym for --silent")
#:action (lambda ()
- ;; XXX: Currently has no effect.
- #t))
+ (set! silent? #t)))
(option
#:long-name "silent" #:short-name #\S
#:takes-argument? #f
#:description (l10n "don't do output to stdout")
#:action (lambda ()
- ;; XXX: Currently has no effect.
- #t))
+ (set! silent? #t)))
(option
;; It might actually be desirable to have an
;; ``insecure'' setup in some circumstances, thus
@@ -469,7 +468,7 @@ (define (main . args)
(%current-service-output-port
;; Send output to log and clients.
(make-shepherd-output-port
- (if syslog?
+ (if (or silent? syslog?)
;; By default we'd write both to /dev/log and to
;; stdout. Redirect stdout to the bitbucket so we
;; don't log twice.