def open(self):
if self.is_open:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>os.chdir(self.working_directory)<EOL>if self.chroot_directory:<EOL><INDENT>os.chroot(self.chroot_directory)<EOL><DEDENT>os.setgid(self.gid)<EOL>os.setuid(self.uid)<EOL>os.umask(self.umask)<EOL><DEDENT>except OSError as err:<EOL><INDENT>raise DaemonError('<STR_LIT>'<EOL>.format(err))<EOL><DEDENT>if self.prevent_core:<EOL><INDENT>try:<EOL><INDENT>resource.setrlimit(resource.RLIMIT_CORE, (<NUM_LIT:0>, <NUM_LIT:0>))<EOL><DEDENT>except Exception as err:<EOL><INDENT>raise DaemonError('<STR_LIT>'<EOL>.format(err))<EOL><DEDENT><DEDENT>if self.detach_process:<EOL><INDENT>try:<EOL><INDENT>if os.fork() > <NUM_LIT:0>:<EOL><INDENT>os._exit(<NUM_LIT:0>)<EOL><DEDENT><DEDENT>except OSError as err:<EOL><INDENT>raise DaemonError('<STR_LIT>'.format(err))<EOL><DEDENT>os.setsid()<EOL>try:<EOL><INDENT>if os.fork() > <NUM_LIT:0>:<EOL><INDENT>os._exit(<NUM_LIT:0>)<EOL><DEDENT><DEDENT>except OSError as err:<EOL><INDENT>raise DaemonError('<STR_LIT>'.format(err))<EOL><DEDENT><DEDENT>for (signal_number, handler) in list(self._signal_handler_map.items()):<EOL><INDENT>signal.signal(signal_number, handler)<EOL><DEDENT>close_filenos(self._files_preserve)<EOL>redirect_stream(sys.stdin, self.stdin)<EOL>redirect_stream(sys.stdout, self.stdout)<EOL>redirect_stream(sys.stderr, self.stderr)<EOL>if self.pidfile:<EOL><INDENT>self.pidfile.acquire()<EOL><DEDENT>self._is_open = True<EOL>
Daemonize this process

        Do everything that is needed to become a Unix daemon.

        :return: None
        :raise: DaemonError