[erlang-questions] erlexec and its environment

David Welton davidnwelton@REDACTED
Tue May 7 11:02:38 CEST 2013

> There are some Erlang functions that have {env, [...]} argument. Ex:
> erlang:open_port/2.
> I think it would be good to have the same syntax ("a list of tuples
> {Name, Val}, where Name is the name of an environment variable, and Val
> is the value it is to have in the spawned port process." and the same
> semantics for exec:run_link/2's {env, [...]}.

That's a good point:

                {env, Env}:
                  This  is  only  valid  for  {spawn, Command} and
{spawn_executable, FileName}. The environment of the started process
is extended
                  using the environment specifications in Env.

This means that it does not clear out the child process' environment,
ever - if env is not specified, it inherits it like you'd expect it
would.  That actually works fine for us, I can't think of a reason
offhand why we'd want to wipe the environment and feed the child
process an empty one.

(Also: why oh why does Erlang not have the capability of handling
stdout and stderr as separate things, as well as a kill function ....
argh! )

David N. Welton



More information about the erlang-questions mailing list