guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49839] [PATCH] shepherd: add keep-tty flag to skip setsid


From: muradm
Subject: [bug#49839] [PATCH] shepherd: add keep-tty flag to skip setsid
Date: Wed, 11 Aug 2021 00:08:36 +0300
User-agent: mu4e 1.4.15; emacs 28.0.50


Hi,

Basically it is samething, should work.
Any idea when to expect it in public?

Thanks in advance,
muradm

Ludovic Courtès <ludo@gnu.org> writes:

Hi,

muradm <mail@muradm.net> skribis:

* modules/shepherd/service.scm: add keep-tty flag to skip setsid

when using shepherd as user, programs like xorg server, potentially
any
program which ends up interacting with user, require terminal to
remain.

currently, setsid is called unconditionally from exec-command
function,
making it impossible to have such process.

this adds keep-tty flag to make-forkexec-constructor up to
exec-command
function where setsid is actually called.

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 587ff68..1ae9544 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -786,6 +786,7 @@ daemon writing FILE is running in a separate PID namespace."
                        (log-file #f)
                        (directory (default-service-directory))
                        (file-creation-mask #f)
+                       (keep-tty #f)
                        (environment-variables (default-environment-variables)))
"Run COMMAND as the current process from DIRECTORY, with FILE-CREATION-MASK if it's true, and with ENVIRONMENT-VARIABLES (a list of strings like
@@ -804,7 +805,7 @@ false."
     ((program args ...)
      ;; Become the leader of a new session and session group.
      ;; Programs such as 'mingetty' expect this.
-     (setsid)
+     (unless keep-tty (setsid))

I did that slightly differently:

  
https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=c43f81794344dbac31bcb8b8f1c0d266f47f14fa

Let me know if it works for you.

Thanks,
Ludo’.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]