def run(self, stdout_func = None, stdin_func = None, stderr_func = None):
        """Runs the process, using the provided functions for I/O.

        The function stdin_func should return strings whenever a
        character or characters become available.
        The functions stdout_func and stderr_func are called whenever
        something is printed to stdout or stderr, respectively.
        These functions are called from different threads (but not
        concurrently, because of the GIL).
        """
        if stdout_func == None and stdin_func == None and stderr_func == None:
            return self._run_stdio()

        if stderr_func != None and self.mergeout:
            raise RuntimeError("Shell command was initiated with "
                    "merged stdin/stdout, but a separate stderr_func "
                    "was provided to the run() method")

        # Create a thread for each input/output handle
        stdin_thread = None
        threads = []
        if stdin_func:
            stdin_thread = threading.Thread(target=self._stdin_thread,
                                args=(self.hstdin, self.piProcInfo.hProcess,
                                stdin_func, stdout_func))
        threads.append(threading.Thread(target=self._stdout_thread,
                                    args=(self.hstdout, stdout_func)))
        if not self.mergeout:
            if stderr_func == None:
                stderr_func = stdout_func
            threads.append(threading.Thread(target=self._stdout_thread,
                                        args=(self.hstderr, stderr_func)))
        # Start the I/O threads and the process
        if ResumeThread(self.piProcInfo.hThread) == 0xFFFFFFFF:
            raise ctypes.WinError()
        if stdin_thread is not None:
            stdin_thread.start()
        for thread in threads:
            thread.start()
        # Wait for the process to complete
        if WaitForSingleObject(self.piProcInfo.hProcess, INFINITE) == \
                    WAIT_FAILED:
            raise ctypes.WinError()
        # Wait for the I/O threads to complete
        for thread in threads:
            thread.join()

        # Wait for the stdin thread to complete
        if stdin_thread is not None:
            stdin_thread.join()
def run ( self , stdout_func = None , stdin_func = None , stderr_func = None ) : if stdout_func == None and stdin_func == None and stderr_func == None : return self . _run_stdio ( ) if stderr_func != None and self . mergeout : raise RuntimeError ( "Shell command was initiated with " "merged stdin/stdout, but a separate stderr_func " "was provided to the run() method" ) stdin_thread = None threads = [ ] if stdin_func : stdin_thread = threading . Thread ( target = self . _stdin_thread , args = ( self . hstdin , self . piProcInfo . hProcess , stdin_func , stdout_func ) ) threads . append ( threading . Thread ( target = self . _stdout_thread , args = ( self . hstdout , stdout_func ) ) ) if not self . mergeout : if stderr_func == None : stderr_func = stdout_func threads . append ( threading . Thread ( target = self . _stdout_thread , args = ( self . hstderr , stderr_func ) ) ) if ResumeThread ( self . piProcInfo . hThread ) == 0xFFFFFFFF : raise ctypes . WinError ( ) if stdin_thread is not None : stdin_thread . start ( ) for thread in threads : thread . start ( ) if WaitForSingleObject ( self . piProcInfo . hProcess , INFINITE ) == WAIT_FAILED : raise ctypes . WinError ( ) for thread in threads : thread . join ( ) if stdin_thread is not None : stdin_thread . join ( )
Runs the process, using the provided functions for I/O.

        The function stdin_func should return strings whenever a
        character or characters become available.
        The functions stdout_func and stderr_func are called whenever
        something is printed to stdout or stderr, respectively.
        These functions are called from different threads (but not
        concurrently, because of the GIL).