[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tail: --pid option does not work when input is a FIFO
From: |
Bernhard Voelker |
Subject: |
tail: --pid option does not work when input is a FIFO |
Date: |
Thu, 17 Oct 2024 23:38:43 +0200 |
User-agent: |
Mozilla Thunderbird |
Hi *,
I noticed that 'tail --pid' does not work when the file to follow is a FIFO.
Shouldn't --pid behave the same regardless whether it's a pipe or not?
# Good case.
$ rm f; touch f # tail to follow regular file.
$ sleep 5 & timeout 10 tail -f --pid=$! f; echo $?
[3] 1030528
[3]+ Done sleep 5
0
# Bad case.
$ rm f; mkfifo f # tail to follow a FIFO file.
$ sleep 5 & timeout 10 tail -f --pid=$! f; echo $?
[3] 1030559
[3]+ Done sleep 5
124
Looking at strace output, one can see that kill() is only invoked once in the
FIFO case.
FWIW: it doesn't make a difference whether one uses -f or -F, whether the
monitored file is written to by another process or stays empty, or whether one
tries with the --sleep-interval option.
Have a nice day,
Berny
- tail: --pid option does not work when input is a FIFO,
Bernhard Voelker <=