Childprocess output oddity


#1

Hey guys -

I just noticed (while parsing some ffprobe output) that ChildProcess::readAllProcessOutput() drops some of the output text.

It’s very reproducible, although exactly what is mangled changes each time.

I was able to fix it by:
waiting for the process to finish, and then reading with a larger char buffer size:

      c.waitForProcessToFinish(1000);  
      for (;;)
      {
          char buffer[16368];
          auto num = c.readProcessOutput (buffer, sizeof (buffer));

          if (num <= 0)
              break;
        
          result.write (buffer, (size_t) num);
      }
     
      String output = result.toString();

Anyway, seemed weird, so kicking it up the chain :slight_smile:

This is on a modern Macbook pro, running 10.13.


#2

There is a long thread about this topic,