def start(self):
        """
        Start defined process.

        After process gets started, timeout countdown begins as well.

        :returns: itself
        :rtype: SimpleExecutor

        .. note::
            We want to open ``stdin``, ``stdout`` and ``stderr`` as text
            streams in universal newlines mode, so we have to set
            ``universal_newlines`` to ``True``.
        """
        if self.process is None:
            command = self.command
            if not self._shell:
                command = self.command_parts

            env = os.environ.copy()
            # Trick with marking subprocesses with an environment variable.
            #
            # There is no easy way to recognize all subprocesses that were
            # spawned during lifetime of a certain subprocess so mirakuru does
            # this hack in order to mark who was the original parent. Even if
            # some subprocess got daemonized or changed original process group
            # mirakuru will be able to find it by this environment variable.
            #
            # There may be a situation when some subprocess will abandon
            # original envs from parents and then it won't be later found.
            env[ENV_UUID] = self._uuid
            popen_kwargs = {
                'shell': self._shell,
                'stdin': subprocess.PIPE,
                'stdout': subprocess.PIPE,
                'universal_newlines': True,
                'env': env,
            }
            if platform.system() != 'Windows':
                popen_kwargs['preexec_fn'] = os.setsid
            self.process = subprocess.Popen(
                command,
                **popen_kwargs
            )

        self._set_timeout()
        return self
def start ( self ) : if self . process is None : command = self . command if not self . _shell : command = self . command_parts env = os . environ . copy ( ) env [ ENV_UUID ] = self . _uuid popen_kwargs = { 'shell' : self . _shell , 'stdin' : subprocess . PIPE , 'stdout' : subprocess . PIPE , 'universal_newlines' : True , 'env' : env , } if platform . system ( ) != 'Windows' : popen_kwargs [ 'preexec_fn' ] = os . setsid self . process = subprocess . Popen ( command , ** popen_kwargs ) self . _set_timeout ( ) return self
Start defined process.

        After process gets started, timeout countdown begins as well.

        :returns: itself
        :rtype: SimpleExecutor

        .. note::
            We want to open ``stdin``, ``stdout`` and ``stderr`` as text
            streams in universal newlines mode, so we have to set
            ``universal_newlines`` to ``True``.