From: Dariqq <dariqq@posteo.net>
To: guix-devel@gnu.org
Subject: Shepherd and the --silent option
Date: Thu, 15 Aug 2024 10:06:28 +0000 [thread overview]
Message-ID: <779f10f0-3cce-4301-a686-7b63c14c618d@posteo.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]
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=e86cfe28c14d734fe917e4935d72e7ad2cc9b299
[-- Attachment #2: shepherd-silence.diff --]
[-- Type: text/x-patch, Size: 2058 bytes --]
diff --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.
next reply other threads:[~2024-08-15 10:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 10:06 Dariqq [this message]
2024-09-08 21:55 ` Shepherd and the --silent option Ludovic Courtès
2024-09-09 8:26 ` Dariqq
2024-09-26 13:02 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=779f10f0-3cce-4301-a686-7b63c14c618d@posteo.net \
--to=dariqq@posteo.net \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.