Tools: properly handle the keyboard interrupt (#2083)
Many tools rely on the user to type Ctrl-C to end, but don't actually
catch the keyboard interrupt and thus show an ugly backtrace when it
happens. Let's catch the interrupt.
diff --git a/tools/tcpaccept.py b/tools/tcpaccept.py
index 884b0c5..e278075 100755
--- a/tools/tcpaccept.py
+++ b/tools/tcpaccept.py
@@ -270,4 +270,7 @@
b["ipv4_events"].open_perf_buffer(print_ipv4_event)
b["ipv6_events"].open_perf_buffer(print_ipv6_event)
while 1:
- b.perf_buffer_poll()
+ try:
+ b.perf_buffer_poll()
+ except KeyboardInterrupt:
+ exit()