Daemonize fix for Windows
- /dev/null isn't available on Windows so just close the console sockets directly
This commit is contained in:
parent
2da4d00730
commit
314af0925f
|
@ -351,12 +351,18 @@ class Main:
|
||||||
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()
|
||||||
si = file('/dev/null', 'r')
|
try:
|
||||||
so = file('/dev/null', 'a+')
|
si = file('/dev/null', 'r')
|
||||||
se = file('/dev/null', 'a+', 0)
|
so = file('/dev/null', 'a+')
|
||||||
os.dup2(si.fileno(), sys.stdin.fileno())
|
se = file('/dev/null', 'a+', 0)
|
||||||
os.dup2(so.fileno(), sys.stdout.fileno())
|
os.dup2(si.fileno(), sys.stdin.fileno())
|
||||||
os.dup2(se.fileno(), sys.stderr.fileno())
|
os.dup2(so.fileno(), sys.stdout.fileno())
|
||||||
|
os.dup2(se.fileno(), sys.stderr.fileno())
|
||||||
|
# /dev/null not available
|
||||||
|
except IOError:
|
||||||
|
sys.stdin.close()
|
||||||
|
sys.stdout.close()
|
||||||
|
sys.stderr.close()
|
||||||
|
|
||||||
def setSignalHandler(self):
|
def setSignalHandler(self):
|
||||||
signal.signal(signal.SIGINT, helper_generic.signal_handler)
|
signal.signal(signal.SIGINT, helper_generic.signal_handler)
|
||||||
|
|
Reference in New Issue
Block a user