unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Shepherd and the --silent option
@ 2024-08-15 10:06 Dariqq
  2024-09-08 21:55 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Dariqq @ 2024-08-15 10:06 UTC (permalink / raw)
  To: guix-devel

[-- 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.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-26 13:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 10:06 Shepherd and the --silent option Dariqq
2024-09-08 21:55 ` Ludovic Courtès
2024-09-09  8:26   ` Dariqq
2024-09-26 13:02     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).