Skip to content

No output if mbpoll output is piped #98

Description

@pvswie

I am running mbpoll (1.0-0) on a pi zero 2W (latest pi os).
It works perfectly showing me the expected results.
My intention however is not to just look at a console but instead process the output.
To do so I piped its output into awk (mbpoll ...... | awk '{...}') but failed to get this to work.
Eventually I found that as soon as the output is piped there effectively is no output anymore.
It was even more surprising that when just redirecting output to a file (mbpoll .... > file.txt) the file DOES get the mbpoll content.
I can positively confirm that while piping mbpoll output the input at the modbus level is still obtained: the LEDs showing communication are flashing. mbpoll internally keeps reading its input.
Due to the above I tried (without success but I am unsure it should work) to have mbpoll redirect to a file and use tail -f on that same file with the intention to pickup the output of mbpoll immediately. This also does not work, tail -f shows the output only once mbpoll is terminated.

Therefore:

  • Is there a way to make mbpoll produce its output, also when piping
  • Any clue as to how to adapt the source and rebuild to fix this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions