Nicer presentation of mount output

This commit is contained in:
Kovid Goyal 2025-04-22 08:26:47 +05:30
parent 8f6a1e0fdc
commit 6e4a865a25
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 3 deletions

View File

@ -113,7 +113,7 @@ def debug(ioreg_to_tmp=False, buf=None, plugins=None,
ioreg = None
if ismacos:
from calibre.devices.usbms.device import Device
mount = '\n'.join(repr(x) for x in Device.osx_run_mount().splitlines())
mount = Device.osx_run_mount()
drives = pprint.pformat(Device.osx_get_usb_drives())
ioreg = 'Output from mount:\n'+mount+'\n\n'
ioreg += 'Output from osx_get_usb_drives:\n'+drives+'\n\n'

View File

@ -347,8 +347,7 @@ class Device(DeviceConfig, DevicePlugin):
def osx_run_mount(cls):
for i in range(3):
try:
return subprocess.Popen('mount',
stdout=subprocess.PIPE).communicate()[0]
return subprocess.Popen('mount', stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'replace')
except OSError: # Probably an interrupted system call
if i == 2:
raise