If ssh dies right after starting, we might get ECONNRESET.

Turn it into a nicer-looking fatal error instead of an exception dump.
This commit is contained in:
Avery Pennarun 2010-12-31 23:46:47 -08:00
parent dc9a5e63c7
commit 651b607361

View File

@ -125,14 +125,20 @@ def _main(listener, fw, ssh_cmd, remotename, python, seed_hosts, auto_nets):
(serverproc, serversock) = ssh.connect(ssh_cmd, remotename, python)
except socket.error, e:
if e.args[0] == errno.EPIPE:
raise Fatal("failed to establish ssh session")
raise Fatal("failed to establish ssh session (1)")
else:
raise
mux = Mux(serversock, serversock)
handlers.append(mux)
expected = 'SSHUTTLE0001'
initstring = serversock.recv(len(expected))
try:
initstring = serversock.recv(len(expected))
except socket.error, e:
if e.args[0] == errno.ECONNRESET:
raise Fatal("failed to establish ssh session (2)")
else:
raise
rv = serverproc.poll()
if rv: