Message ID | 20211220214528.GA11706@Mem (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | BPF |
Headers | show |
Series | [bpf,v3] bpftool: Enable line buffering for stdout | expand |
On 12/20/21 1:45 PM, Paul Chaignon wrote: > The output of bpftool prog tracelog is currently buffered, which is > inconvenient when piping the output into other commands. A simple > tracelog | grep will typically not display anything. This patch fixes it > by enabling line buffering on stdout for the whole bpftool binary. > > Fixes: 30da46b5dc3a ("tools: bpftool: add a command to dump the trace pipe") > Signed-off-by: Quentin Monnet <quentin@isovalent.com> > Signed-off-by: Paul Chaignon <paul@isovalent.com> Acked-by: Yonghong Song <yhs@fb.com>
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 28237d7cef67..8fbcff9d557d 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -400,6 +400,8 @@ int main(int argc, char **argv) }; int opt, ret; + setlinebuf(stdout); + last_do_help = do_help; pretty_output = false; json_output = false;