Skip to content

Commit

Permalink
AP_HAL_Linux: Enforce line buffering
Browse files Browse the repository at this point in the history
Helpful when run via systemd or other tool that captures stdout for logging purpose
  • Loading branch information
Oleksiy Protas authored and landswellsong committed Oct 23, 2024
1 parent 92693e0 commit fec5156
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/AP_HAL_Linux/HAL_Linux_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ void HAL_Linux::run(int argc, char* const argv[], Callbacks* callbacks) const
CMDLINE_SERIAL9,
};

// set explicit line buffering for e.g. logging via systemd
setvbuf(stdout, (char *)0, _IOLBF, 0);
setvbuf(stderr, (char *)0, _IOLBF, 0);

int opt;
const struct GetOptLong::option options[] = {
{"uartA", true, 0, 'A'},
Expand Down

0 comments on commit fec5156

Please sign in to comment.