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
|
# launch all the GUI apps, forking before Qt is loaded and not during a
|
||||||
# python import.
|
# python import.
|
||||||
|
|
||||||
|
is_detached = False
|
||||||
|
|
||||||
def do_detach(fork=True, setsid=True, redirect=True):
|
def do_detach(fork=True, setsid=True, redirect=True):
|
||||||
|
global is_detached
|
||||||
if fork:
|
if fork:
|
||||||
# Detach from the controlling process.
|
# Detach from the controlling process.
|
||||||
if os.fork() != 0:
|
if os.fork() != 0:
|
||||||
@ -23,10 +26,8 @@ def do_detach(fork=True, setsid=True, redirect=True):
|
|||||||
os.setsid()
|
os.setsid()
|
||||||
if redirect:
|
if redirect:
|
||||||
from calibre.constants import plugins
|
from calibre.constants import plugins
|
||||||
try:
|
plugins['speedup'][0].detach(os.devnull)
|
||||||
plugins['speedup'][0].detach(os.devnull)
|
is_detached = True
|
||||||
except AttributeError:
|
|
||||||
pass # people running from source without updated binaries
|
|
||||||
|
|
||||||
def detach_gui():
|
def detach_gui():
|
||||||
from calibre.constants import islinux, isbsd, DEBUG
|
from calibre.constants import islinux, isbsd, DEBUG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user