mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-30 19:03:25 +02:00
Track when GUI processes are detached
This commit is contained in:
parent
7e0be5825e
commit
8291e02f12
1 changed files with 5 additions and 4 deletions
|
|
@ -14,7 +14,10 @@
|
|||
# launch all the GUI apps, forking before Qt is loaded and not during a
|
||||
# python import.
|
||||
|
||||
is_detached = False
|
||||
|
||||
def do_detach(fork=True, setsid=True, redirect=True):
|
||||
global is_detached
|
||||
if fork:
|
||||
# Detach from the controlling process.
|
||||
if os.fork() != 0:
|
||||
|
|
@ -23,10 +26,8 @@ def do_detach(fork=True, setsid=True, redirect=True):
|
|||
os.setsid()
|
||||
if redirect:
|
||||
from calibre.constants import plugins
|
||||
try:
|
||||
plugins['speedup'][0].detach(os.devnull)
|
||||
except AttributeError:
|
||||
pass # people running from source without updated binaries
|
||||
plugins['speedup'][0].detach(os.devnull)
|
||||
is_detached = True
|
||||
|
||||
def detach_gui():
|
||||
from calibre.constants import islinux, isbsd, DEBUG
|
||||
|
|
|
|||
Loading…
Reference in a new issue