From: Ido Schimmel <ido...@mellanox.com> Similar to commit 09e0528cf977 ("ip: mroute: add fflush to print_mroute"), we need to add fflush() to the print functions to get the following to work:
# devlink mon &> log Without it, stdout output is buffered and not written to the disk. This is useful when writing tests that rely on devlink-monitor output. Signed-off-by: Ido Schimmel <ido...@mellanox.com> Acked-by: Jiri Pirko <j...@mellanox.com> --- devlink/devlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devlink/devlink.c b/devlink/devlink.c index 817b74259ec3..6fa3be69ff1a 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -58,6 +58,7 @@ static int g_new_line_count; } \ fprintf(stdout, ##args); \ g_new_line_count = 0; \ + fflush(stdout); \ } while (0) #define pr_out_sp(num, args...) \ @@ -66,6 +67,7 @@ static int g_new_line_count; if (ret < num) \ fprintf(stdout, "%*s", num - ret, ""); \ g_new_line_count = 0; \ + fflush(stdout); \ } while (0) static int g_indent_level; -- 2.20.1