mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
compile_srv should use the headless exe when running calibre-debug
This commit is contained in:
parent
b8ea550a76
commit
74bd089c64
@ -18,9 +18,10 @@ from polyglot.builtins import exec_path
|
||||
def run_calibre_debug(*args, **kw):
|
||||
import subprocess
|
||||
creationflags = 0
|
||||
headless = bool(kw.pop('headless', False))
|
||||
if iswindows:
|
||||
creationflags = subprocess.CREATE_NO_WINDOW
|
||||
cmd = get_debug_executable() + list(args)
|
||||
cmd = get_debug_executable(headless=headless) + list(args)
|
||||
kw['creationflags'] = creationflags
|
||||
return subprocess.Popen(cmd, **kw)
|
||||
|
||||
|
@ -22,10 +22,15 @@ builtins.__dict__['dynamic_property'] = lambda func: func(None)
|
||||
from calibre.constants import iswindows, ismacos, islinux, DEBUG, isfreebsd
|
||||
|
||||
|
||||
def get_debug_executable():
|
||||
def get_debug_executable(headless=False):
|
||||
exe_name = 'calibre-debug' + ('.exe' if iswindows else '')
|
||||
if hasattr(sys, 'frameworks_dir'):
|
||||
base = os.path.dirname(sys.frameworks_dir)
|
||||
if headless:
|
||||
from calibre.utils.ipc.launch import Worker
|
||||
class W(Worker):
|
||||
exe_name = 'calibre-debug'
|
||||
return [W().executable]
|
||||
return [os.path.join(base, 'MacOS', exe_name)]
|
||||
if getattr(sys, 'run_local', None):
|
||||
return [sys.run_local, exe_name]
|
||||
|
@ -140,11 +140,10 @@ class Worker:
|
||||
except:
|
||||
pass
|
||||
|
||||
def __init__(self, env, gui=False, job_name=None):
|
||||
self._env = {}
|
||||
def __init__(self, env=None, gui=False, job_name=None):
|
||||
self.gui = gui
|
||||
self.job_name = job_name
|
||||
self._env = env.copy()
|
||||
self._env = (env or {}).copy()
|
||||
|
||||
def __call__(self, redirect_output=True, cwd=None, priority=None, pass_fds=()):
|
||||
'''
|
||||
|
@ -233,7 +233,7 @@ def forked_compile():
|
||||
def run_forked_compile(data, options):
|
||||
from calibre.debug import run_calibre_debug
|
||||
p = run_calibre_debug('-c', 'from calibre.utils.rapydscript import *; forked_compile()',
|
||||
json.dumps(options), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
json.dumps(options), stdin=subprocess.PIPE, stdout=subprocess.PIPE, headless=True)
|
||||
stdout = p.communicate(as_bytes(data))[0]
|
||||
if p.wait() != 0:
|
||||
raise SystemExit(p.returncode)
|
||||
|
Loading…
x
Reference in New Issue
Block a user