workaround decode failure

This commit is contained in:
Kovid Goyal 2022-08-17 18:36:36 +05:30
parent 0b5f4b9174
commit 51d8e95557
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -114,7 +114,11 @@ def debug(ioreg_to_tmp=False, buf=None, plugins=None,
drives = pprint.pformat(Device.osx_get_usb_drives()) drives = pprint.pformat(Device.osx_get_usb_drives())
ioreg = 'Output from mount:\n'+mount+'\n\n' ioreg = 'Output from mount:\n'+mount+'\n\n'
ioreg += 'Output from osx_get_usb_drives:\n'+drives+'\n\n' ioreg += 'Output from osx_get_usb_drives:\n'+drives+'\n\n'
ioreg += Device.run_ioreg().decode('utf-8', 'replace') iro = Device.run_ioreg()
try:
ioreg += iro.decode('utf-8', 'replace')
except UnicodeDecodeError:
ioreg += repr(iro)
connected_devices = [] connected_devices = []
if disabled_plugins: if disabled_plugins:
out('\nDisabled plugins:', textwrap.fill(' '.join([x.__class__.__name__ for x in out('\nDisabled plugins:', textwrap.fill(' '.join([x.__class__.__name__ for x in