Piping input to a shell command and keeping the created shell alive
Do you have access to the C program source code? My guess is that the C program is using istty(0)
to determine if stdin is coming from a terminal. It probably only creates an interactive shell when that is the case. Using stdin redirection, whether from a file or a pipe, means that istty(0)
returns false.