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/lib/uflow.py b/tools/lib/uflow.py
index 02cad55..63fab87 100755
--- a/tools/lib/uflow.py
+++ b/tools/lib/uflow.py
@@ -206,4 +206,7 @@
bpf["calls"].open_perf_buffer(print_event)
while 1:
- bpf.perf_buffer_poll()
+ try:
+ bpf.perf_buffer_poll()
+ except KeyboardInterrupt:
+ exit()