traceflow icon indicating copy to clipboard operation
traceflow copied to clipboard

Handle KeyboardInterrupts cleanly

Open cambrant opened this issue 6 years ago • 3 comments

When using traceflow interactively, it's cleaner to gracefully catch KeyboardInterrupts instead of throwing an exception. Ideally it would be less ugly to put the packet sending code in the main loop in a separate method and wrap that in a try..except block.

cambrant avatar Oct 12 '19 17:10 cambrant

Hey @cambrant ! Thank you for the PR. I can see the interrupt handled correctly during the initial discovery run:

python3.6 traceflow/__main__.py 1.1.1.1
Resolved 1.1.1.1 to 1.1.1.1
Looking at Path ID 1 (src port:33453 , dst port:33452)
Looking at Path ID 2 (src port:33454 , dst port:33452)
Looking at Path ID 3 (src port:33455 , dst port:33452)
^C
Aborted.

However while serving viz via httpd.serve_forever(), we do not seem to intercept correctly. Can you import sys in printer.py please and re-commit?

rucarrol avatar Oct 19 '19 10:10 rucarrol

Hi, you are right about that. This is fixed and updated now, assuming I understood your remark properly.

cambrant avatar Nov 01 '19 13:11 cambrant

Could you please once more rebase on current master? Thank you!

awlx avatar Nov 10 '19 11:11 awlx