Skip to content

Commit 2962f6a

Browse files
ikichadkruces
authored andcommitted
Add sys.stdout.flush() during print (iovisor#5142)
without that, pipe doesn't work well because of buffer
1 parent 8fa1bcc commit 2962f6a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/tcpstates.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from bcc import BPF
2020
import argparse
2121
from socket import inet_ntop, AF_INET, AF_INET6
22+
import sys
2223
from time import strftime, time
2324
from os import getuid
2425

@@ -434,6 +435,7 @@ def print_ipv6_event(cpu, data, size):
434435
b["ipv6_events"].open_perf_buffer(print_ipv6_event, page_cnt=64)
435436
while 1:
436437
try:
438+
sys.stdout.flush()
437439
b.perf_buffer_poll()
438440
except KeyboardInterrupt:
439441
exit()

0 commit comments

Comments
 (0)