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/dbslower.py b/tools/dbslower.py
index 92d4127..24e6394 100755
--- a/tools/dbslower.py
+++ b/tools/dbslower.py
@@ -230,4 +230,7 @@
bpf["events"].open_perf_buffer(print_event, page_cnt=64)
while True:
- bpf.perf_buffer_poll()
+ try:
+ bpf.perf_buffer_poll()
+ except KeyboardInterrupt:
+ exit()