FILE* buffers are duplicated when fork()ing, and at program exit(), the C
library flushes the FILE* buffers, resulting in duplicated output.
To avoid this we flush all FILE* buffers before fork()ing.
import cstdlib = tango.stdc.stdlib;
import cstring = tango.stdc.string;
import cstdlib = tango.stdc.stdlib;
import cstring = tango.stdc.string;
+import cstdio = tango.stdc.stdio;
/*
* This is a small optimization that proved it's usefulness. For small chunks
/*
* This is a small optimization that proved it's usefulness. For small chunks
gc.stats.world_stopped();
if (opts.options.fork) {
gc.stats.world_stopped();
if (opts.options.fork) {
+ cstdio.fflush(null); // avoid duplicated FILE* output
os.pid_t child_pid = os.fork();
assert (child_pid != -1); // don't accept errors in non-release mode
switch (child_pid) {
os.pid_t child_pid = os.fork();
assert (child_pid != -1); // don't accept errors in non-release mode
switch (child_pid) {