Breaking infinite loop by keyboard entry