Is it possible to prevent application from hanging when both stdin and stdout are connected to named pipes?
问题 Consider the following simple C program, which I will compile to a program called "A": #include <stdio.h> int main(int argc, char** argv){ putchar('C'); putchar('\n'); } Now, consider the following bash script: #!/bin/bash mkfifo Output1.pipe mkfifo Output2.pipe stdbuf -i0 -o0 -e0 ./A > Output1.pipe & stdbuf -i0 -o0 -e0 ./A > Output2.pipe & cat Output1.pipe cat Output2.pipe The output of this script is C\nC . So far everything is fine. Now let's consider the following modification the bash