I've made a daemon that launch commands.
If the execvp function waiting for standard input (with cat, grep, wc, by example), I have to redirect stdin to a named pipe.
Currently, my daemon always open the named pipe and redirect stdin before execvp, I have to manually CTRL+D so that the execution of commands can continue.
I would like to use this pipe only if the command asking for standard input.
Example:
cat | wc -l : I'm opening my named pipe and redirect stdin to it before execvp
ls | wc -l : I don't open the named pipe, execvp pass successfully