Fix NoShell to flush the error before exiting

If we don't flush the stderr stream the packet containing the
error message doesn't make it to the client.  This was broken
by an upgrade in MINA SSHD, I suspect the output streams are
not flushing their buffer completely during close.

We also need to include a "\r" in the message because the shell
is running inside of a pty, the pty expects us to move the cursor
back to column 0 via terminal command codes.

Change-Id: Ifb33dbff07c7431a0205e12eca2b5018636e387b
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-01-16 14:35:42 -08:00
parent 2f8b9bc3b7
commit 1e6e31b6e8

View File

@@ -56,7 +56,9 @@ class NoShell implements Factory<Command> {
}
public void start(final Environment env) throws IOException {
err.write(Constants.encodeASCII("gerrit: no shell available\n"));
err.write(Constants.encodeASCII("gerrit: no shell available\r\n"));
err.flush();
in.close();
out.close();
err.close();