I have a script that runs my application (c++) with STDIN redirected from a fifo and redirects STDOUT to a file. The following code runs just fine on ubuntu 18:
./my_app 0</home/user/pipe 1> log.txt &
I'm sending instructions to the fifo with printf:
printf "ins\n" > /home/user/pipe
In the app reading is done std::getline in a try-catch block which works just fine on ubuntu 18, but on ubuntu 20 eofbit and failbit are always set after the first instruction is read.
The whole script looks like:
#!/bin/bash
./my_app 0</home/user/pipe 1> log.txt &
sleep 1
printf "ins1\n" > /home/user/pipe
sleep 5
printf "ins2\n" > /home/user/pipe
.
.
For the example above, i am able to read 'ins1' but nothing after
Later edit:
Working now, with something to keep the pipe open.
sleep infinity > /home/user/pipe & before starting the app and killing the sleep at the end