mirror of
https://github.com/huashengdun/webssh.git
synced 2026-08-20 04:36:42 +00:00
Merge pull request #270 from Zotil/encoding_timeout
timeout on exec_command
This commit is contained in:
+11
-6
@@ -427,15 +427,20 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
||||
|
||||
for command in commands:
|
||||
try:
|
||||
_, stdout, _ = ssh.exec_command(command, get_pty=True)
|
||||
_, stdout, _ = ssh.exec_command(command,
|
||||
get_pty=True,
|
||||
timeout=1)
|
||||
except paramiko.SSHException as exc:
|
||||
logging.info(str(exc))
|
||||
else:
|
||||
data = stdout.read()
|
||||
logging.debug('{!r} => {!r}'.format(command, data))
|
||||
result = self.parse_encoding(data)
|
||||
if result:
|
||||
return result
|
||||
try:
|
||||
data = stdout.read()
|
||||
logging.debug('{!r} => {!r}'.format(command, data))
|
||||
result = self.parse_encoding(data)
|
||||
if result:
|
||||
return result
|
||||
except socket.timeout:
|
||||
pass
|
||||
|
||||
logging.warning('Could not detect the default encoding.')
|
||||
return 'utf-8'
|
||||
|
||||
Reference in New Issue
Block a user