I have a C program which spawns a pthread to act as an interactive terminal: reading lines from stdin
& acting upon them. The program acts as a kind of shell, fork
-ing off processes; each process so created has its stdin
re-directed using a call to freopen()
before using exec
to load the new executable.
Before the interactive thread is started, all works fine. Once it has started (or, more specifically, whenever it is waiting for input), calls to freopen()
hang. Is there some way to avoid this problem?