// On OSX this code causes a segfault. (dmd 2.063.2)
void sub() {
import std.process;
execute(["echo", "hello"]);
}
void main() {
import std.concurrency;
spawn(&sub);
}
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
[Switching to process 39151 thread 0x1203]
0x0000000100038a2c in D3std7process7environFNbNdNeZxPPa ()
(gdb) bt
#0 0x0000000100038a2c in D3std7process7environFNbNdNeZxPPa ()
#1 0x00000001000390bf in D3std7process9createEnvFxHAyaAyabZPxPa ()
#2 0x0000000100038df7 in D3std7process16spawnProcessImplFNexAAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigZC3std7process3Pid ()
#3 0x0000000100038ae9 in D3std7process12spawnProcessFNexAAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigZC3std7process3Pid ()
#4 0x000000010003a9cb in D3std7process159__T15pipeProcessImplS129_D3std7process12spawnProcessFNexAAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigZC3std7process3PidTAAyaZ15pipeProcessImplFNeAAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipes ()
#5 0x0000000100039add in D3std7process11pipeProcessFNeAAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipes ()
#6 0x0000000100001959 in D3std7process138__T11executeImplS112_D3std7process11pipeProcessFNeAAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipesTAAyaZ11executeImplFAAyaxHAyaAyaE3std7process6ConfigmZS3std7process138__T11executeImplS112_D3std7process11pipeProcessFNeAAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipesTAAyaZ11executeImplFAAyaxHAyaAyaE3std7process6ConfigmZ13ProcessOutput ()
#7 0x0000000100039e69 in D3std7process7executeFNeAAyaxHAyaAyaE3std7process6ConfigmZS3std7process138__T11executeImplS112_D3std7process11pipeProcessFNeAAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipesTAAyaZ11executeImplFAAyaxHAyaAyaE3std7process6ConfigmZ13ProcessOutput ()
#8 0x0000000100001495 in D9spawnpipe3subFZv ()
#9 0x0000000100002765 in D3std11concurrency16__T6_spawnTPFZvZ6_spawnFbPFZvZS3std11concurrency3Tid4execMFZv ()
#10 0x0000000100012851 in D4core6thread6Thread3runMFZv ()
#11 0x0000000100011fed in thread_entryPoint ()
#12 0x00007fff8d731772 in _pthread_start ()
#13 0x00007fff8d71e1a1 in thread_start ()
Same thing happens with core.thread.Thread insead of std.concurrency.spawn, and other variants like std.process.{spawnProcess,spawnShell,pipeProcess,pipeShell}.
Works ok in linux. (2.063.2)
Comment #1 by hans — 2013-10-24T20:48:30Z
*** This issue has been marked as a duplicate of issue 11112 ***