This commit is contained in:
Kovid Goyal 2025-04-05 13:52:34 +05:30
parent 7373d2362a
commit 2be0d6a650
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -845,6 +845,8 @@ def viewer_main():
render_for_viewer(*args)
# QuickLook {{{
def quicklook(pathtoebook: str, output_dir: str) -> dict[str, object]:
pathtoebook = os.path.abspath(pathtoebook)
output_dir = os.path.abspath(output_dir)
@ -880,10 +882,10 @@ def handle_quicklook_client(c) -> None:
return
req = json.loads(line)
try:
output = {'ok': True, 'result': quicklook(req['path'], req['output_dir'])}
output = {'ok': True, 'path': req['path'], 'result': quicklook(req['path'], req['output_dir'])}
except Exception as e:
import traceback
output = {'ok': False, 'error': str(e), 'traceback': traceback.format_exc()}
output = {'ok': False, 'path': req['path'], 'error': str(e), 'traceback': traceback.format_exc()}
with c.makefile('w', encoding='utf-8') as outf:
json.dump(output, outf)
print(file=outf, flush=True)
@ -938,6 +940,8 @@ def quicklook_service(path_to_socket: str) -> None:
c.shutdown(socket.SHUT_RDWR)
c.close()
# }}}
class Profiler: