[armedbear-devel] run-program :environment nil

Ville Voutilainen ville.voutilainen at gmail.com
Tue Mar 27 16:41:57 UTC 2012


On 27 March 2012 16:42, Pascal J. Bourguignon <pjb at informatimago.com> wrote:
> I like the following API, which is implemented in clisp.
> (getenv)        --> the current environment as an a-list.
>                    (("LC_CTYPE" . "C") ("TERM" . "/bin/bash") …)
> (getenv "TERM") --> the string value, or NIL if the variable is not
>                    present in the environment.
>                    "/bin/bash"
> (setf (getenv "LC_CTYPE") "en_US.UTF-8")
>                    changes the environment for the current process and
>                    its future children.
> (setf (getenv "LC_CTYPE") nil)

I dcn't think we can get that far. Java doesn't seem to support
environment modifications
that way, see http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getenv%28%29
and in particular "Returns an unmodifiable string map view of the
current system environment."
Note the "unmodifiable".

We could allow setting the environment for run-program. Here's what I'd do:

1) fix the documentation of run-program to mention the environment merging
2) add a new function that can completely replace the default
environment for the program
to run, use an alist or a hash. Also add a function that can return
the full environment, for cases where you
don't want to rebuild everything.

Comments? Opinions?




More information about the armedbear-devel mailing list