mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-17 16:34:44 -05:00
Fixed an issue where the PSQL tool would hang when the database encoding was set to SQL_ASCII and certain commands were executed.
This commit is contained in:
@@ -205,9 +205,16 @@ def read_terminal_data(parent, data_ready, max_read_bytes, sid):
|
||||
if parent in data_ready:
|
||||
# Read the output from parent fd (terminal).
|
||||
output = os.read(parent, max_read_bytes)
|
||||
try:
|
||||
decode_data = output.decode()
|
||||
except Exception:
|
||||
try:
|
||||
decode_data = output.decode('UTF-8')
|
||||
except Exception:
|
||||
decode_data = output.decode('UTF-8', errors='replace')
|
||||
|
||||
sio.emit('pty-output',
|
||||
{'result': output.decode(),
|
||||
{'result': decode_data,
|
||||
'error': False},
|
||||
namespace='/pty', room=sid)
|
||||
|
||||
|
||||
@@ -246,10 +246,12 @@ class TextLoaderpgAdmin(TextLoader):
|
||||
return bytes(data).decode(python_encoding)
|
||||
return data.decode(python_encoding)
|
||||
except Exception:
|
||||
if isinstance(data, memoryview):
|
||||
return bytes(data).decode('UTF-8')
|
||||
return data.decode('UTF-8')
|
||||
else:
|
||||
if isinstance(data, memoryview):
|
||||
return bytes(data).decode('ascii', errors='replace')
|
||||
return data.decode('ascii', errors='replace')
|
||||
try:
|
||||
if isinstance(data, memoryview):
|
||||
return bytes(data).decode('UTF-8')
|
||||
return data.decode('UTF-8')
|
||||
except Exception:
|
||||
if isinstance(data, memoryview):
|
||||
return bytes(data).decode('ascii',
|
||||
errors='replace')
|
||||
return data.decode('ascii', errors='replace')
|
||||
|
||||
Reference in New Issue
Block a user