// DMD64 D Compiler v2.066.1 on OS X 10.10.1
// results core.exception.InvalidMemoryOperationError@(0)
import core.sys.posix.unistd;
void main() {
fork();
}
// ok
import core.sys.posix.unistd;
extern(C): // ++++
void main() {
fork();
}
// ok
import core.sys.posix.unistd;
void main() {
if (fork() == 0) {
_exit(0);
}
}
// ok
import core.sys.posix.unistd;
void main() {
if (fork() == 0) {
// call exec*
}
}
// why ?
Comment #1 by greeenify — 2018-07-02T21:56:11Z
*** Issue 15511 has been marked as a duplicate of this issue. ***
Comment #2 by schveiguy — 2018-07-03T12:49:50Z
It's likely something to do with D RT shutdown, since all the cases that pass do NOT do that.
It would be helpful to know where the exception is happening.
I almost want to close this as WONTFIX, as forking and treating the process like it's a normal process is really not a valid use case for fork. See http://www.evanjones.ca/fork-is-dangerous.html
Comment #3 by pro.mathias.lang — 2020-01-16T14:26:00Z