I wrote a module that partially replaces RunProgram() stuff with native NSTask, just to go around those bugs:
viewtopic.php?f=24&t=75993
viewtopic.php?f=24&t=68306
viewtopic.php?f=24&t=78078
It supports writing to program's stdin, getting its stdout/stderr (as long as they are less than 64KB) and retrieving exit codes.
The latest version is available here - https://github.com/deseven/pb-macos-task