On 07-12-2012 14:20, Jakob Bornecrantz wrote:
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.

Thanks, fixed.

--
Alex Rønne Petersen
a...@lycus.org
http://lycus.org

Reply via email to