has started a shell.
I thought this change would fix a problem with the Windows 8 Preview where
the connection shut down immediately after starting. It did not fix the
problem, which I still don't have an explanation for, but in any case, I
think the change is necessary.
* The TestNet protocol starts with a terminal resize escape sequence, so
the server discards all input until it sees the sequence, and it delays
starting the agent. Eventually, the goal is to implement an SSH server,
and the SSH message that creates a PTY also provides the terminal size.
* Use disconnected() instead of readChannelFinished().
* Cleanup. There are three bidirectional pipes conceptually:
console <-> agent
agent <-> server
server <-> client
If one end of a pipe dies, start closing the other end, then clean up.
If the console dies (e.g. because cmd.exe exits), we still want to
collect the final console output and send it to the client.
To help with this, in the Agent, I call GetConsoleProcessList, then
scrapeOutput, then (potentially) disconnectFromServer.