compat/terminal: separate input and output handles