From 8291e02f12c6164db1d4cb9c19dbc472409216a3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Nov 2014 09:14:28 +0530 Subject: [PATCH] Track when GUI processes are detached --- src/calibre/gui_launch.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui_launch.py b/src/calibre/gui_launch.py index f08ec861ee..5972c1097f 100644 --- a/src/calibre/gui_launch.py +++ b/src/calibre/gui_launch.py @@ -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