[FIX] add EOF exception into switchto

This commit is contained in:
Benedek Racz 2019-10-08 11:32:09 +02:00
parent 8f1aeb7da8
commit 0b1dec9535
2 changed files with 18 additions and 8 deletions

View File

@ -39,9 +39,10 @@ after_test:
# Create source distribution. # Create source distribution.
- python -m setup sdist - python -m setup sdist
# Upload to test pypi # Upload to pypi.
- twine upload -r testpypi dist\\wexpect*.tar.gz # More precisely. Upload pypi the master builds, and to test-pypi any other builds.
- git branch | find "* master" > NUL & IF ERRORLEVEL 1 ( \
# Upload to offitial pypi twine upload -r testpypi dist\\wexpect*.tar.gz \
- twine upload -r pypi dist\\wexpect*.tar.gz ) ELSE ( \
twine upload -r pypi dist\\wexpect*.tar.gz )

View File

@ -2064,6 +2064,15 @@ class Wtty:
win32console.AttachConsole(self.conpid) win32console.AttachConsole(self.conpid)
self.__consin = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE) self.__consin = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE)
self.__consout = self.getConsoleOut() self.__consout = self.getConsoleOut()
except pywintypes.error as e:
# pywintypes.error: (5, 'AttachConsole', 'Access is denied.')
# When child has finished...
logging.info(e)
# In case of any error: We "switch back" (attach) our original console, then raise the
# error.
win32console.AttachConsole(self.__parentPid)
raise EOF('End Of File (EOF) in switchTo().')
except: except:
# In case of any error: We "switch back" (attach) our original console, then raise the # In case of any error: We "switch back" (attach) our original console, then raise the
# error. # error.