On Tuesday, 26 February 2013 at 14:22:08 UTC, Steven
Schveighoffer wrote:
On Sat, 23 Feb 2013 06:31:19 -0500, Lars T. Kyllingstad
<[email protected]> wrote:
It's been years in the coming, but we finally got it done. :)
The upshot is that the module has actually seen active use
over those years, both by yours truly and others, so hopefully
the worst wrinkles are already ironed out.
Pull request:
https://github.com/D-Programming-Language/phobos/pull/1151
Code:
https://github.com/kyllingstad/phobos/blob/std-process2/std/process2.d
Documentation:
http://www.kyllingen.net/code/std-process2/phobos-prerelease/std_process2.html
I hope we can get it reviewed in time for the next release.
(The wiki page indicates that both std.benchmark and std.uni
are currently being reviewed, but I fail to find any
"official" review threads on the forum. Is the wiki just out
of date?)
I just reread the docs, considering Vladimir's point about
space-containing no-arg programs. I agree there is a problem.
We need to not get rid of the single program version of spawn,
we need to simply interpret it as a no-arg program.
To have this not work:
spawnProcess("c:/Program Files/xyz/xyz.exe");
and require this instead:
spawnProcess("c:/Program Files/xyz/xyz.exe", []);
is not very intuitive.
It reminds me of when we had writefln and not writeln, in order
to print out a string with % in it, you had to do
writefln("%s", "%s");
Now, I think we have an additional issue in that it's difficult
to take a string argument with parameters in it, and pass it in
one line:
string executeThis = "prog arg1 arg2";
auto params = split(executeThis);
spawnProcess(params[0], params[1..$]);
It would be nice to just be able to do this:
spawnProcess(split(executeThis));
I think we need an overload for that, especially if we get rid
of the auto-splitting of commands. It should assert if the
array is empty.
I propose we only have two versions:
spawnProcess(string[] args, File stdin, etc...)
spawnProcess(string[] args, string[string] env, File stdin,
etc...)
You'd use it like this:
spawnProcess(["prog"]);
spawnProcess(["prog", "arg1", "arg2"])
etc.
Then it would also work with split().
Lars