New std.process revival

Jakob Bornecrantz wallbraker at gmail.com
Fri Dec 7 05:20:06 PST 2012


On Thursday, 6 December 2012 at 18:40:57 UTC, Alex Rønne Petersen 
wrote:
> Hi,
>
> I decided to take a stab at reviving the new std.process 
> written by Lars T. Kyllingstad and Steven Schveighoffer.
>
> The result is here: 
> https://github.com/alexrp/phobos/tree/new-std-process-update

https://github.com/alexrp/phobos/blob/new-std-process-update/std/process.d#L417

You need to call toArgz and toStringz before the fork, since 
either of those can be in TLS. Test with:


string cmd = "echo";
string[] args1 = ["hello"];
string[] args2 = [];

void main()
{
   spawnProcess(cmd, args2);
   spawnProcess(cmd, args1);
   args ~= "World";
   spawnProcess(cmd, args2);
}


I'm not exactly sure what is up, but in one of my projects I had 
this problem. I solved it by just making all the string[]s into 
__gshared.

Cheers, Jakob.


More information about the Digitalmars-d mailing list