'Initialize the named pipes used for communication with the child
process.'

def _initialize_named_pipes_for_std(self):

    pid = os.getpid()
    _saAttr_pipe = win32security.SECURITY_ATTRIBUTES()
    _saAttr_pipe.bInheritHandle = 0
    _saAttr_file = win32security.SECURITY_ATTRIBUTES()
    _saAttr_file.bInheritHandle = 1
    def create_namedpipe_and_file(prefix, saAttr_pipe=_saAttr_pipe, saAttr_file=_saAttr_file):
        'Create    the    named    pipe    and    the    file    for    it.\n\n                                                :param    prefix:    string    representing    the    prefix    which    will    be\n                                                                appended    to    the    start    of    the    name    for    the    pipe\n                                                :param    saAttr_pipe:    security    attributes    used    to    create\n                                                                the    named    pipe\n                                                :param    saAttr_file:    security    attributes    used    to    create    the    file\n                                                '
        pipename = ('%s_NamedPipe_%d_%d_%s' % (prefix, pid, time.time(), str(random.random()).split('.')[1]))
        pipe = NamedPipe(pipe_name=pipename, sec_attributes=saAttr_pipe)
        pipe.create_file(sec_attributes=saAttr_file)
        return pipe
    _pipe_stdin = create_namedpipe_and_file('Stdin')
    self._pipe_stdout = create_namedpipe_and_file('Stdout')
    self._pipe_stderr = create_namedpipe_and_file('Stderr')
    self._si.hStdInput = _pipe_stdin.get_file_handle()
    self._si.hStdOutput = self._pipe_stdout.get_file_handle()
    self._si.hStdError = self._pipe_stderr.get_file_handle()
    self._si.dwFlags |= win32con.STARTF_USESTDHANDLES
    self.stdin = ProcessWithNamedPipes.HandleClass(_pipe_stdin)
    _pipe_stdin = None
