rs1729 / RS

radiosonde decoding
GNU General Public License v3.0
171 stars 56 forks source link

pos2nmea: Enforce line buffering #37

Closed SammysHP closed 3 years ago

SammysHP commented 3 years ago

When connected to stdout, perl uses line buffering. If not connected to stdout (e.g. from a pipe) it defaults to block buffering. This causes a long delay and decoding issues when using the NMEA output in other tools.

With this change always use line buffering so that NMEA messages are flushed immediately.

Tested with NMEAoIP and GPSD:

<decoder> | pos2nmea.pl | socat - tcp-l:4444,reuseaddr,fork
<decoder> | pos2nmea.pl | gpsd -Nnrb /dev/stdin

Or with the test data in the repository:

ffmpeg -re -i rs41/wav/20140717_402MHz.wav -f wav - | ./rs41mod -i | pos2nmea.pl | socat - tcp-l:4444,reuseaddr,fork