Changeset View
Changeset View
Standalone View
Standalone View
kolabd/__init__.py
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | def run(self): | ||||
elif pid > 0: | elif pid > 0: | ||||
sys.exit(0) | sys.exit(0) | ||||
else: | else: | ||||
# Give up the session, all control, | # Give up the session, all control, | ||||
# all open file descriptors, see #5151 | # all open file descriptors, see #5151 | ||||
os.chdir("/") | os.chdir("/") | ||||
os.umask(0) | old_umask = os.umask(0) | ||||
os.setsid() | os.setsid() | ||||
pid = os.fork() | pid = os.fork() | ||||
if pid > 0: | if pid > 0: | ||||
sys.exit(0) | sys.exit(0) | ||||
sys.stderr.flush() | sys.stderr.flush() | ||||
sys.stdout.flush() | sys.stdout.flush() | ||||
os.close(0) | os.close(0) | ||||
os.close(1) | os.close(1) | ||||
os.close(2) | os.close(2) | ||||
os.open(os.devnull, os.O_RDONLY) | os.open(os.devnull, os.O_RDONLY) | ||||
os.open(os.devnull, os.O_WRONLY) | os.open(os.devnull, os.O_WRONLY) | ||||
os.open(os.devnull, os.O_WRONLY) | os.open(os.devnull, os.O_WRONLY) | ||||
os.umask(old_umask) | |||||
log.remove_stdout_handler() | log.remove_stdout_handler() | ||||
self.set_signal_handlers() | self.set_signal_handlers() | ||||
self.write_pid() | self.write_pid() | ||||
self.do_sync() | self.do_sync() | ||||
except SystemExit as errcode: | except SystemExit as errcode: | ||||
exitcode = errcode | exitcode = errcode | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |