# Childprocess output oddity

**URL:** <https://forum.juce.com/t/childprocess-output-oddity/31758>\
**Category:** General JUCE discussion\
**Created:** [February 13, 2019, 11:11pm UTC](https://forum.juce.com/t/childprocess-output-oddity/31758 "2019-02-13T23:11:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronleese1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese1/32/19725_2.png) [@aaronleese1](https://forum.juce.com/u/aaronleese1)\
**Post date:** [February 13, 2019, 11:11pm UTC](https://forum.juce.com/t/childprocess-output-oddity/31758/1 "2019-02-13T23:11:19Z")

</div>

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 🙂

This is on a modern Macbook pro, running 10.13.

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [February 14, 2019, 7:43am UTC](https://forum.juce.com/t/childprocess-output-oddity/31758/2 "2019-02-14T07:43:42Z")

</div>

There is a long thread about this topic,

> [@ChildProcess broken on MacOS?](https://forum.juce.com/t/childprocess-broken-on-macos/27049):
>
> issue #1 for (;;) { ChildProcess cp; cp.start("cat nonexistingfile"); String output=cp.readAllProcessOutput(); DBG("OUTPUT:"+output); DBG("EXITCODE:"+String(cp.getExitCode())); Thread::sleep(100); }; –\> sometimes exitcode 0 (should be 1, because the file does not exist) EXITCODE:1 OUTPUT:cat: nonexistingfile: No such file or directory EXITCODE:1 OUTPUT:cat: nonexistingfile: No such file or directory EX…
