readAllProcessOutput() blocking question

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?

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

1 Like

Ah thanks for clarification :slight_smile: