"You use the word intuitive a couple of times, and suggest there's a natural way to exit interactive cli programs (and it's not ctrl-d)."
Surely it is when you detect the angry mashing of keys?
There should really be a function for that in the standard library. Distinguishing such inputs from the actions of cats would be the difficult bit.