summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrice Waegeneire <brice@waegenei.re>2021-07-03 22:40:28 +0200
committerGuix Patches Tester <>2021-07-03 21:42:12 +0100
commitd85c30a1b4687f55caf1a5be02585ff22d015a35 (patch)
tree89b1440021f31e183189579b013e06cbd69ff18e
parentbe3689647048d04cac939d48540ec6b9c3594747 (diff)
downloadguix-patches-d85c30a1b4687f55caf1a5be02585ff22d015a35.tar
guix-patches-d85c30a1b4687f55caf1a5be02585ff22d015a35.tar.gz
services: gpm: Use "make-forkexec-contstructor".series-8629
* gnu/services/base.scm (gpm-shepherd-service)[start]: Replace custom logic with "make-forkexec-constructor".
-rw-r--r--gnu/services/base.scm24
1 files changed, 7 insertions, 17 deletions
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")