Formal Review of std.process

Lars T. Kyllingstad public at kyllingen.net
Thu Apr 4 22:54:36 PDT 2013


The following is a message posted by Johannes Pfau to the other 
(pre-)review thread which didn't seem to get noticed, along with 
an edited version of my reply.

On Sunday, 31 March 2013 at 13:14:52 UTC, Johannes Pfau wrote:
>
> Reposted from github:
> I think it would be nice if the high level functions would also 
> allow
> using custom environment variables. So the execute and 
> executeShell
> functions should have overloads which accept a string[string] 
> with
> environment variables (and probably accept a Config as well).
>
> The execute and executeShell functions would be trivial to 
> implement
> though if pipeProcess / pipeShell had an overload with 
> environment
> and Config parameters. So it's probably more important that
> pipeProcess / pipeShell get these overloads.

I have to say, I am really warming to the idea.  This would come 
at no cost to the actual usage of these functions; you could 
still call execute like this:

     execute("my_app");

The cost would be in the form of more complex function signatures 
(and consequently documentation):

ProcessPipes pipeProcess(
     string[] args,
     Redirect redirectFlags = Redirect.all,
     string[string] env = null,
     Config config = Config.none);

Tuple execute(
     string[] args,
     string[string] env = null,
     Config config = Config.none);

Implementation-wise, it is a trivial task to add this 
functionality to both pipeProcess/pipeShell and 
execute/executeShell.  It's a simple matter of forwarding the 
extra arguments to spawnProcess, with some filtering of 'config'.

Lars


More information about the Digitalmars-d mailing list