Beispiel #1
0
    def spawnProcess(self, processProtocol, executable, args=(),
                     env={}, path=None,
                     uid=None, gid=None, usePTY=0, childFDs=None):
        args, env = self._checkProcessArgs(args, env)
        if platformType == 'posix':
            if usePTY:
                if childFDs is not None:
                    raise ValueError("Using childFDs is not supported with usePTY=True.")
                return process.PTYProcess(self, executable, args, env, path,
                                          processProtocol, uid, gid, usePTY)
            else:
                return process.Process(self, executable, args, env, path,
                                       processProtocol, uid, gid, childFDs)
        elif platformType == "win32":
            if uid is not None:
                raise ValueError("Setting UID is unsupported on this platform.")
            if gid is not None:
                raise ValueError("Setting GID is unsupported on this platform.")
            if usePTY:
                raise ValueError("The usePTY parameter is not supported on Windows.")
            if childFDs:
                raise ValueError("Customizing childFDs is not supported on Windows.")

            if win32process:
                from twisted.internet._dumbwin32proc import Process
                return Process(self, processProtocol, executable, args, env, path)
            else:
                raise NotImplementedError(
                    "spawnProcess not available since pywin32 is not installed.")
        else:
            raise NotImplementedError(
                "spawnProcess only available on Windows or POSIX.")
 def spawnProcess(
     self,
     processProtocol,
     executable,
     args=(),
     env={},
     path=None,
     uid=None,
     gid=None,
     usePTY=0,
     childFDs=None,
 ):
     """
     Spawn a process.
     """
     if uid is not None:
         raise ValueError("Setting UID is unsupported on this platform.")
     if gid is not None:
         raise ValueError("Setting GID is unsupported on this platform.")
     if usePTY:
         raise ValueError("PTYs are unsupported on this platform.")
     if childFDs is not None:
         raise ValueError(
             "Custom child file descriptor mappings are unsupported on "
             "this platform."
         )
     args, env = self._checkProcessArgs(args, env)
     return Process(self, processProtocol, executable, args, env, path)
Beispiel #3
0
 def spawnProcess(self,
                  processProtocol,
                  executable,
                  args=(),
                  env={},
                  path=None,
                  uid=None,
                  gid=None,
                  usePTY=0):
     """Spawn a process."""
     if uid is not None:
         raise ValueError("Setting UID is unsupported on this platform.")
     if gid is not None:
         raise ValueError("Setting GID is unsupported on this platform.")
     if usePTY:
         raise ValueError("PTYs are unsupported on this platform.")
     return Process(self, processProtocol, executable, args, env, path)