diff mbox series

[bug#49365] services: gpm: Use "make-forkexec-contstructor".

Message ID 20210703204028.11582-1-brice@waegenei.re
State Accepted
Headers show
Series [bug#49365] services: gpm: Use "make-forkexec-contstructor". | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Brice Waegeneire July 3, 2021, 8:40 p.m. UTC
* gnu/services/base.scm (gpm-shepherd-service)[start]: Replace custom
logic with "make-forkexec-constructor".
---
 gnu/services/base.scm | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

Comments

Mathieu Othacehe July 7, 2021, 2:30 p.m. UTC | #1
Hello Brice,

> * gnu/services/base.scm (gpm-shepherd-service)[start]: Replace custom
> logic with "make-forkexec-constructor".

This seems fine, thanks!

Mathieu
Brice Waegeneire July 13, 2021, 5:28 a.m. UTC | #2
Mathieu Othacehe <othacehe@gnu.org> writes:

>> * gnu/services/base.scm (gpm-shepherd-service)[start]: Replace custom
>> logic with "make-forkexec-constructor".

Thank you for the review, pushed as
1beeef62614dc61876558bcd70af11e2bd6854d6.
diff mbox series

Patch

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6922d7f90b..ab3e441a7b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2217,23 +2217,13 @@  instance."
      (list (shepherd-service
             (requirement '(udev))
             (provision '(gpm))
-            (start #~(lambda ()
-                       ;; 'gpm' runs in the background and sets a PID file.
-                       ;; Note that it requires running as "root".
-                       (false-if-exception (delete-file "/var/run/gpm.pid"))
-                       (fork+exec-command (list #$(file-append gpm "/sbin/gpm")
-                                                #$@options))
-
-                       ;; Wait for the PID file to appear; declare failure if
-                       ;; it doesn't show up.
-                       (let loop ((i 3))
-                         (or (file-exists? "/var/run/gpm.pid")
-                             (if (zero? i)
-                                 #f
-                                 (begin
-                                   (sleep 1)
-                                   (loop (1- i))))))))
-
+            ;; 'gpm' runs in the background and sets a PID file.
+            ;; Note that it requires running as "root".
+            (start #~(make-forkexec-constructor
+                      (list #$(file-append gpm "/sbin/gpm")
+                            #$@options)
+                      #:pid-file "/var/run/gpm.pid"
+                      #:pid-file-timeout 3))
             (stop #~(lambda (_)
                       ;; Return #f if successfully stopped.
                       (not (zero? (system* #$(file-append gpm "/sbin/gpm")