communicators/ssh: cleanup PTY code for GH-4408]