Ticket #5390: twisted-w32-create-process.patch

File twisted-w32-create-process.patch, 1.2 KB (added by Greg MacDonald, 5 years ago)
  • twisted/internet/_dumbwin32proc.py

     
    1616import win32pipe
    1717import win32process
    1818import win32security
     19import winerror
    1920
    2021import pywintypes
    2122
     
    172173        cmdline = quoteArguments(args)
    173174        # TODO: error detection here.  See #2787 and #4184.
    174175        def doCreate():
    175             self.hProcess, self.hThread, self.pid, dwTid = win32process.CreateProcess(
    176                 command, cmdline, None, None, 1, 0, env, path, StartupInfo)
     176            try:
     177                self.hProcess, self.hThread, self.pid, dwTid = win32process.CreateProcess(
     178                    command, cmdline, None, None, 1, 0, env, path, StartupInfo)
     179            except pywintypes.error, pwte:
     180                if pwte.args[0] != winerror.ERROR_FILE_NOT_FOUND:
     181                    raise
     182                self.hProcess, self.hThread, self.pid, dwTid = win32process.CreateProcess(
     183                    None, cmdline, None, None, 1, 0, env, path, StartupInfo)
    177184        try:
    178185            try:
    179186                doCreate()