summaryrefslogtreecommitdiffstats
path: root/sysif.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-09-26 10:17:00 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-09-26 10:17:00 -0700
commitda59e8ce3fc5a35b3d22dd971ff96f498f655a98 (patch)
treec29c855e17d545e71d657e5630cc6ee364f7f6d8 /sysif.h
parentba75167d1e7c609b829978b3f4a748ce3cf69ad9 (diff)
downloadtxr-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 'sysif.h')
-rw-r--r--sysif.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysif.h b/sysif.h
index 6dc150e2..2da92a32 100644
--- a/sysif.h
+++ b/sysif.h
@@ -36,6 +36,9 @@ extern val atime_s, mtime_s, ctime_s;
extern val atime_nsec_s, mtime_nsec_s, ctime_nsec_s;
extern val path_s;
+extern val child_env_s;
+#define child_env (deref(lookup_var_l(nil, child_env_s)))
+
val errno_to_file_error(int err);
val env(void);
val replace_env(val env_list);