[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmd] 02/03: Export and document 'exec-command'.
From: |
Ludovic Courtès |
Subject: |
[dmd] 02/03: Export and document 'exec-command'. |
Date: |
Mon, 23 Jun 2014 22:09:21 +0000 |
civodul pushed a commit to branch master
in repository dmd.
commit 0d4d788a6f92c58a0968275f7b154aac23a944e1
Author: Ludovic Courtès <address@hidden>
Date: Tue Jun 24 00:01:37 2014 +0200
Export and document 'exec-command'.
* modules/dmd/service.scm (exec-command): Export. Augment docstring.
* dmd.texi (Service De- and Constructors): Document it.
---
dmd.texi | 13 +++++++++++++
modules/dmd/service.scm | 11 +++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dmd.texi b/dmd.texi
index 757a66e..d5fa881 100644
--- a/dmd.texi
+++ b/dmd.texi
@@ -826,6 +826,19 @@ calling the destructor; if it would not do that, killing
the process
in the destructor would immediately respawn the service.
@end deffn
+The @code{make-forkexec-constructor} procedure builds upon the following
+procedure.
+
address@hidden {procedure} exec-command @var{command} @
+ [#:directory (default-service-directory)] @
+ [#:environment-variables (default-environment-variables)]
+Run @var{command} as the current process from @var{directory}, and with
address@hidden (a list of strings like @code{"PATH=/bin"}.)
+File descriptors 1 and 2 are kept as is, whereas file descriptor 0
+(standard input) points to @file{/dev/null}; all other file descriptors
+are closed prior to yielding control to @var{command}.
address@hidden deffn
+
@c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@node Service Examples
diff --git a/modules/dmd/service.scm b/modules/dmd/service.scm
index 2d99c1d..8b6266e 100644
--- a/modules/dmd/service.scm
+++ b/modules/dmd/service.scm
@@ -60,6 +60,7 @@
handle-unknown
make-forkexec-constructor
make-kill-destructor
+ exec-command
make-system-constructor
make-system-destructor
make-init.d-service
@@ -563,8 +564,14 @@ set when starting a service."
(environ))
(define* (exec-command command
- #:key directory environment-variables)
- "Run COMMAND with the given settings."
+ #:key
+ (directory (default-service-directory))
+ (environment-variables (default-environment-variables)))
+ "Run COMMAND as the current process from DIRECTORY, and with
+ENVIRONMENT-VARIABLES (a list of strings like \"PATH=/bin\".) File
+descriptors 1 and 2 are kept as is, whereas file descriptor 0 (standard
+input) points to /dev/null; all other file descriptors are closed prior to
+yielding control to COMMAND."
(match command
((program args ...)
;; Become the leader of a new session and session group.