debconf-communicate: Handle frontends that need a tty
debconf-communicate reads from stdin and writes to stdout, to communicate in the debconf protocol.
This clashes with frontends that need a tty: The behavior may differ, but for example, the dialog frontend is going to render the prompt on stdout and only read input from the tty.
To make debconf-communicate work when it runs frontends that need to interact with the user, duplicate stdin and stdout, then attach the the tty to the actual stdin/stdout (so the frontend can interact with the user), and finally use our duplicated old stdin/stdout to speak debconf protocol.