poll() support and tidy on keypress exit.