mirror of https://github.com/huashengdun/webssh
commit
cd3c747747
|
@ -427,15 +427,20 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
try:
|
try:
|
||||||
_, stdout, _ = ssh.exec_command(command, get_pty=True)
|
_, stdout, _ = ssh.exec_command(command,
|
||||||
|
get_pty=True,
|
||||||
|
timeout=1)
|
||||||
except paramiko.SSHException as exc:
|
except paramiko.SSHException as exc:
|
||||||
logging.info(str(exc))
|
logging.info(str(exc))
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
data = stdout.read()
|
data = stdout.read()
|
||||||
logging.debug('{!r} => {!r}'.format(command, data))
|
logging.debug('{!r} => {!r}'.format(command, data))
|
||||||
result = self.parse_encoding(data)
|
result = self.parse_encoding(data)
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
except socket.timeout:
|
||||||
|
pass
|
||||||
|
|
||||||
logging.warning('Could not detect the default encoding.')
|
logging.warning('Could not detect the default encoding.')
|
||||||
return 'utf-8'
|
return 'utf-8'
|
||||||
|
|
Loading…
Reference in New Issue