I have a program that creates a FIFO (named pipe) file in /path/to/directory, then deletes it. I have somehow managed to stop it being deleted, but still I can't read/write/copy anything on it.
For example;
$ cp 15796 test
It just keeps waiting, then exits itself (I think).
If I'm quick enough, I can get partial data out of this pipe. Is there a way to copy all data sent through this pipe?
cat fifoand see it. – terdon Sep 08 '22 at 16:32cat < fifo > someOtherFile) before launching the program, and then launch the program and have it write to the existing fifo? – terdon Sep 09 '22 at 10:005610, then I launch it again and it creates another fifo named as7410. I guess It takes his name from pid. – Erikli Sep 09 '22 at 12:13inotifywaitto detect the creation of the file or, if it is indeed the PID, run something likewhile :; do pid=$(pgrep -f programName); if [ -n "$pid" ]; then cat < /path/to/directory/"$pid"; fi; doneto read from it. You will still have a race condition, but should get something at least. – terdon Sep 09 '22 at 16:55