'Spawn an operating-system process.
This is where the hard work of disconnecting all currently open
files / forking / executing the new process happens.  (This is
executed automatically when a Process is instantiated.)
This will also run the subprocess as a given user ID and group ID, if
specified.  (Implementation Note: this doesn\'t support all the arcane
nuances of setXXuid on UNIX: it will assume that either your effective
or real UID is 0.)'

def __init__(self, reactor, executable, args, environment, path, proto, uid=None, gid=None, usePTY=None):

    if ((pty is None) and (not isinstance(usePTY, (tuple, list)))):
        raise NotImplementedError('cannot    use    PTYProcess    on    platforms    without    the    pty    module.')
    abstract.FileDescriptor.__init__(self, reactor)
    _BaseProcess.__init__(self, proto)
    if isinstance(usePTY, (tuple, list)):
        (masterfd, slavefd, _) = usePTY
    else:
        (masterfd, slavefd) = pty.openpty()
    try:
        self._fork(path, uid, gid, executable, args, environment, masterfd=masterfd, slavefd=slavefd)
    except:
        if (not isinstance(usePTY, (tuple, list))):
            os.close(masterfd)
            os.close(slavefd)
        raise
    os.close(slavefd)
    fdesc.setNonBlocking(masterfd)
    self.fd = masterfd
    self.startReading()
    self.connected = 1
    self.status = (-1)
    try:
        self.proto.makeConnection(self)
    except:
        log.err()
    registerReapProcessHandler(self.pid, self)
