mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Track when GUI processes are detached
This commit is contained in:
parent
7e0be5825e
commit
8291e02f12
@ -14,7 +14,10 @@ import os, sys
|
||||
# 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…
x
Reference in New Issue
Block a user