readAllProcessOutput() blocking question


#1

The documentation says:

Blocks until the process has finished, and then returns its complete output
as a string.

But if i look into the source-code:

String ChildProcess::readAllProcessOutput()
{
    MemoryOutputStream result;

    for (;;)
    {
        char buffer[512];
        auto num = readProcessOutput (buffer, sizeof (buffer));

        if (num <= 0)
            break;

        result.write (buffer, (size_t) num);
    }

    return result.toString();
}

It looks like, it also returns immediately when the process has no output but is still running?


ChildProcess issues on macOS 10.12.6
#2

No… I think readProcessOutput will block and wait for either the process to die, or to create some new output.


#3

Ah thanks for clarification :slight_smile: