A more flexible way to get terminal input.