Python win32api.GetStdHandle() Examples
The following are 7
code examples of win32api.GetStdHandle().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32api
, or try the search function
.
Example #1
Source File: process_helper.py From learn_python3_spider with MIT License | 9 votes |
def main(): if sys.argv[1] == 'child': if sys.argv[2] == 'windows': import win32api as api, win32process as proc info = proc.STARTUPINFO() info.hStdInput = api.GetStdHandle(api.STD_INPUT_HANDLE) info.hStdOutput = api.GetStdHandle(api.STD_OUTPUT_HANDLE) info.hStdError = api.GetStdHandle(api.STD_ERROR_HANDLE) python = sys.executable scriptDir = os.path.dirname(__file__) scriptName = os.path.basename(__file__) proc.CreateProcess( None, " ".join((python, scriptName, "grandchild")), None, None, 1, 0, os.environ, scriptDir, info) else: if os.fork() == 0: grandchild() else: grandchild()
Example #2
Source File: process_helper.py From python-for-android with Apache License 2.0 | 6 votes |
def main(): if sys.argv[1] == 'child': if sys.argv[2] == 'windows': import win32api as api, win32process as proc info = proc.STARTUPINFO() info.hStdInput = api.GetStdHandle(api.STD_INPUT_HANDLE) info.hStdOutput = api.GetStdHandle(api.STD_OUTPUT_HANDLE) info.hStdError = api.GetStdHandle(api.STD_ERROR_HANDLE) python = sys.executable scriptDir = os.path.dirname(__file__) scriptName = os.path.basename(__file__) proc.CreateProcess( None, " ".join((python, scriptName, "grandchild")), None, None, 1, 0, os.environ, scriptDir, info) else: if os.fork() == 0: grandchild() else: grandchild()
Example #3
Source File: _win32stdio.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def __init__(self, proto, reactor=None): """ Start talking to standard IO with the given protocol. Also, put it stdin/stdout/stderr into binary mode. """ if reactor is None: from twisted.internet import reactor for stdfd in range(0, 1, 2): msvcrt.setmode(stdfd, os.O_BINARY) _pollingfile._PollingTimer.__init__(self, reactor) self.proto = proto hstdin = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE) hstdout = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE) self.stdin = _pollingfile._PollableReadPipe( hstdin, self.dataReceived, self.readConnectionLost) self.stdout = _pollingfile._PollableWritePipe( hstdout, self.writeConnectionLost) self._addPollableResource(self.stdin) self._addPollableResource(self.stdout) self.proto.makeConnection(self)
Example #4
Source File: process_helper.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def main(): if sys.argv[1] == 'child': if sys.argv[2] == 'windows': import win32api as api, win32process as proc info = proc.STARTUPINFO() info.hStdInput = api.GetStdHandle(api.STD_INPUT_HANDLE) info.hStdOutput = api.GetStdHandle(api.STD_OUTPUT_HANDLE) info.hStdError = api.GetStdHandle(api.STD_ERROR_HANDLE) python = sys.executable scriptDir = os.path.dirname(__file__) scriptName = os.path.basename(__file__) proc.CreateProcess( None, " ".join((python, scriptName, "grandchild")), None, None, 1, 0, os.environ, scriptDir, info) else: if os.fork() == 0: grandchild() else: grandchild()
Example #5
Source File: _win32stdio.py From learn_python3_spider with MIT License | 5 votes |
def __init__(self, proto, reactor=None): """ Start talking to standard IO with the given protocol. Also, put it stdin/stdout/stderr into binary mode. """ if reactor is None: from twisted.internet import reactor for stdfd in range(0, 1, 2): msvcrt.setmode(stdfd, os.O_BINARY) _pollingfile._PollingTimer.__init__(self, reactor) self.proto = proto hstdin = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE) hstdout = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE) self.stdin = _pollingfile._PollableReadPipe( hstdin, self.dataReceived, self.readConnectionLost) self.stdout = _pollingfile._PollableWritePipe( hstdout, self.writeConnectionLost) self._addPollableResource(self.stdin) self._addPollableResource(self.stdout) self.proto.makeConnection(self)
Example #6
Source File: _win32stdio.py From python-for-android with Apache License 2.0 | 5 votes |
def __init__(self, proto): """ Start talking to standard IO with the given protocol. Also, put it stdin/stdout/stderr into binary mode. """ from twisted.internet import reactor for stdfd in range(0, 1, 2): msvcrt.setmode(stdfd, os.O_BINARY) _pollingfile._PollingTimer.__init__(self, reactor) self.proto = proto hstdin = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE) hstdout = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE) self.stdin = _pollingfile._PollableReadPipe( hstdin, self.dataReceived, self.readConnectionLost) self.stdout = _pollingfile._PollableWritePipe( hstdout, self.writeConnectionLost) self._addPollableResource(self.stdin) self._addPollableResource(self.stdout) self.proto.makeConnection(self)
Example #7
Source File: _win32stdio.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, proto): """ Start talking to standard IO with the given protocol. Also, put it stdin/stdout/stderr into binary mode. """ from twisted.internet import reactor for stdfd in range(0, 1, 2): msvcrt.setmode(stdfd, os.O_BINARY) _pollingfile._PollingTimer.__init__(self, reactor) self.proto = proto hstdin = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE) hstdout = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE) self.stdin = _pollingfile._PollableReadPipe( hstdin, self.dataReceived, self.readConnectionLost) self.stdout = _pollingfile._PollableWritePipe( hstdout, self.writeConnectionLost) self._addPollableResource(self.stdin) self._addPollableResource(self.stdout) self.proto.makeConnection(self)