The situation I have is this: I’m redirecting input from one spot in my program to another through a pipe. However, it does not appear that this is working correctly, so I’d like to monitor what’s going through the pipe.
Currently, I’m using dup2() to simply overwrite the stdin and stdout from the pipe.
How can I monitor what’s going between the pipe?
When I’m debugging a pipe in a bash script I’ll often use the tee command to capture what’s going through it without disrupting the flow.
There’s a corresponding tee system call which looks like it might be useful for debugging pipes in C code, but I’ve never tried it.