From e8a6f437306d6e6dc3576a47181aad3a2b741f2b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 7 Nov 2019 06:37:02 -0800 Subject: open-process: new variant, open-subprocess. * stream.c (open_subprocess): new function, formed by adding fun argument to open_process. Since the program name can be nil now, in which case argv is not allocated, the code must be careful not to access argv if it is null. (open_process): Reduced to trivial wrapper around open_subprocess. (stream_init): open-subprocess intrinsic registered. * txr.1: Documented. --- txr.1 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index f49c8d95..d175a774 100644 --- a/txr.1 +++ b/txr.1 @@ -50511,6 +50511,8 @@ function returns the previous value. .synb .mets (open-command < system-command <> [ mode-string ]) .mets (open-process < program < mode-string <> [ argument-list ]) +.mets (open-subprocess < program < mode-string +.mets \ \ >> [ argument-list <> [ function ]]) .syne .desc These functions spawn external programs which execute concurrently @@ -50754,6 +50756,36 @@ is simulated via and therefore does not support the redirection syntax; it is parsed and ignored. +The +.code open-subprocess +function is a variant of +.code open-process +that is available on platforms which have a +.code fork +function. This function has all the same argument conventions and semantics as +.codn open-process , +adding the +.meta function +argument. If this argument isn't +.codn nil , +then it must specify a function which can be called with no arguments. +This function is called in the child process after any redirections are +established, just before the program specified by the +.meta program +argument is executed. Moreover, the +.code open-subprocess +function allows +.meta program +to be specified as +.code nil +in which case +.meta function +must be specified. When +.meta function +returns, the child process terminates as if by a call to +.code exit* +with an argument of zero. + .SS* I/O-Related Convenience Functions The functions in this group create a stream, perform an I/O operation -- cgit v1.2.3