Reworked code for cancelling an external command via keybinding