diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-09-26 10:17:00 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-09-26 10:17:00 -0700 |
commit | da59e8ce3fc5a35b3d22dd971ff96f498f655a98 (patch) | |
tree | c29c855e17d545e71d657e5630cc6ee364f7f6d8 /tests/018 | |
parent | ba75167d1e7c609b829978b3f4a748ce3cf69ad9 (diff) | |
download | txr-da59e8ce3fc5a35b3d22dd971ff96f498f655a98.tar.gz txr-da59e8ce3fc5a35b3d22dd971ff96f498f655a98.tar.bz2 txr-da59e8ce3fc5a35b3d22dd971ff96f498f655a98.zip |
New variable: *child-env*.
This specifies the environment to be used for executing
programs.
* stream.c (open_subprocess, run): Check *child-env* variable and if
other than t, then install the environment before execvp.
In the spawn-based version of run, we save and restore the
environment around the spawn call, if *child-env* is in
effect.
* sysif.c (child_env_s): New symbol variable.
(exec_wrap): If *child-env* is other than t, then save the
environment in a list, and install the specified environment
before calling execvp. If that function returns, restore the
environbment.
* sysif.h (child_env_s): Declared.
(child_env): New macro.
* tests/018/process.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/018')
-rw-r--r-- | tests/018/process.tl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/018/process.tl b/tests/018/process.tl index 07ecfb64..a1970738 100644 --- a/tests/018/process.tl +++ b/tests/018/process.tl @@ -25,3 +25,17 @@ (mtest (fcmd (let ((*stdout* *stdnull*)) (sh "echo foo"))) "" (fcmd (let ((*stderr* *stdout*)) (sh "echo foo 1>&2"))) "foo\n"))) + +(mtest + (let ((*child-env* '("a=b"))) + (get-lines (open-process "/usr/bin/env" "r"))) + ("a=b") + (let ((*child-env* nil)) + (get-lines (open-process "/usr/bin/env" "r"))) + nil) + +(test + (fcmd + (let ((*child-env* '("a=b"))) + (run "/usr/bin/env"))) + "a=b\n") |