def _run_stdio(self):
"""Runs the process using the system standard I/O.
IMPORTANT: stdin needs to be asynchronous, so the Python
sys.stdin object is not used. Instead,
msvcrt.kbhit/getwch are used asynchronously.
"""
# Disable Line and Echo mode
#lpMode = DWORD()
#handle = msvcrt.get_osfhandle(sys.stdin.fileno())
#if GetConsoleMode(handle, ctypes.byref(lpMode)):
# set_console_mode = True
# if not SetConsoleMode(handle, lpMode.value &
# ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT)):
# raise ctypes.WinError()
if self.mergeout:
return self.run(stdout_func = self._stdout_raw,
stdin_func = self._stdin_raw_block)
else:
return self.run(stdout_func = self._stdout_raw,
stdin_func = self._stdin_raw_block,
stderr_func = self._stderr_raw)
# Restore the previous console mode
#if set_console_mode:
# if not SetConsoleMode(handle, lpMode.value):
# raise ctypes.WinError()
评论列表
文章目录