Break out of a while loop when an ESC key is pressed

This code will break out of a while true loop when an ESC key is pressed