Fix calibre 5.4 not running via Launch Services on macOS

This commit is contained in:
Kovid Goyal 2020-10-30 12:57:27 +05:30
parent ab93b6cde3
commit abcdb53b0e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -48,12 +48,14 @@ def main():
set_helper()
set_quit()
mod = __import__(sys.calibre_module, fromlist=[1])
func = getattr(mod, sys.calibre_function)
if sys.gui_app and not (
sys.stdout.isatty() or sys.stderr.isatty() or sys.stdin.isatty()
):
# this has to be done after calibre is imported and therefore
# calibre_extensions is available.
nuke_stdout()
mod = __import__(sys.calibre_module, fromlist=[1])
func = getattr(mod, sys.calibre_function)
return func()