I'm porting something, and I want to run a non-Free Pascal subprocess from a parent Free Pascal process. The parent needs pipes to and from the subprocess. TProcess supports this, but only if the I/O is via the subprocess's stdin and stdout. I want to create pipes in the parent process in Free Pascal, and pass them to the subprocess. (Stdout in the subprocess is being used for human-readable output, and unavailable for the structured data being passed in and out.) Is there any way to do this?
In the original program, the parent process created pipes and sent the FD numbers to the child process on the command line. The child process then connected them up. All this requires is that TProcess not close some specific file descriptors when forking. But there's no obvious option for that.