On individual installations of 10.12.6 only, there seem to be transient issues with readAllProcessOutput() that haven’t occurred on earlier versions of macOS. In the code snippet below, output would occasionally be empty, despite the child process writing to stdout.
ChildProcess spawn;
if (spawn.start (commandTokens, wantStdOut | wantStdErr))
{
String output = spawn.readAllProcessOutput();
int error = spawn.getExitCode();
}
Users consistently reported this on that version of macOS only, although I could not reproduce it yet. Seems to depend on hardware (speed) or system components.
Passing output through an external file instead however fixed it, which makes me believe the pipe might have become unstable for some reason.
Has anyone else observed this?
Would adding a delay before readAllProcessOutput() possibly help by allowing the pipe some time to establish?
And, as we are at it, I’d like to suggest putting a small delay into the loop of ChildProcess::waitForProcessToFinish, as otherwise it does excessive pollling at an insane rate.