parent
a29f7534ee
commit
20cbac9752
|
@ -316,14 +316,24 @@ class Main:
|
||||||
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
|
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
|
||||||
|
|
||||||
def daemonize(self):
|
def daemonize(self):
|
||||||
if os.fork():
|
try:
|
||||||
exit(0)
|
if os.fork():
|
||||||
shared.thisapp.lock() # relock
|
exit(0)
|
||||||
|
except AttributeError:
|
||||||
|
# fork not implemented
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
shared.thisapp.lock() # relock
|
||||||
os.umask(0)
|
os.umask(0)
|
||||||
os.setsid()
|
os.setsid()
|
||||||
if os.fork():
|
try:
|
||||||
exit(0)
|
if os.fork():
|
||||||
shared.thisapp.lock() # relock
|
exit(0)
|
||||||
|
except AttributeError:
|
||||||
|
# fork not implemented
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
shared.thisapp.lock() # relock
|
||||||
shared.thisapp.lockPid = None # indicate we're the final child
|
shared.thisapp.lockPid = None # indicate we're the final child
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user