Properly wait for spawned processes to end

This commit is contained in:
Chris Josten 2020-06-29 23:51:40 +02:00
parent 76b3ca0d33
commit 791a08363a

View file

@ -111,16 +111,21 @@ class Page {
pandoc.stdin.writeln(); pandoc.stdin.writeln();
pandoc.stdin.flush(); pandoc.stdin.flush();
pandoc.stdin.close(); pandoc.stdin.close();
pandoc.pid.wait();
string result; string result;
string line; string line;
while ((line = pandoc.stdout.readln()) !is null) { while ((line = pandoc.stdout.readln()) !is null) {
result ~= line; result ~= line;
debug {
logf("Pandoc stdout: %s", line); logf("Pandoc stdout: %s", line);
} }
}
while ((line = pandoc.stderr.readln()) !is null) { while ((line = pandoc.stderr.readln()) !is null) {
debug {
logf("Pandoc stderr: %s", line); logf("Pandoc stderr: %s", line);
} }
}
return result; return result;
} }