I want to call a process and provide stdin and get stdout how to do that?
The pipe gives and takes a file and I do not know how to read it or create one from just hard coded string, this is somewhat pseudo code, any ideas how to make it work:
A dangerous working snippet for illustration purposes. You still need check optional entries here.
I did need to read the standard library example to understand this. To be able to pass the stdin you need to write to child.stdin using the writer interface, and after that you need to close it to “send EOF” otherwise the cat process get stuck waiting for it.
Some of things I didn’t understand: I tried to get the stdout.bufferedLen but it’s always returning 0 (My guess is this zeroed after child wait but I need to dig more into this), so I used stdout_reader.pos instead to delimiter until where I should read the output, but I believe this is not the ideal nor safe.