コード例 #1
0
ファイル: _subprocess.py プロジェクト: cavr/MongoCourse
def WaitForSingleObject(handle, milliseconds):
    res = _WaitForSingleObject(int(handle), milliseconds)

    if res < 0:
        raise _WinError()

    return res
コード例 #2
0
ファイル: _subprocess.py プロジェクト: Qointum/pypy
def WaitForSingleObject(handle, milliseconds):
    res = _WaitForSingleObject(int(handle), milliseconds)

    if res < 0:
        raise _WinError()

    return res
コード例 #3
0
ファイル: _subprocess.py プロジェクト: cavr/MongoCourse
def CreateProcess(name, command_line, process_attr, thread_attr, inherit,
                  flags, env, start_dir, startup_info):
    si = _STARTUPINFO()
    if startup_info is not None:
        si.dwFlags = startup_info.dwFlags
        si.wShowWindow = startup_info.wShowWindow
        if startup_info.hStdInput:
            si.hStdInput = int(startup_info.hStdInput)
        if startup_info.hStdOutput:
            si.hStdOutput = int(startup_info.hStdOutput)
        if startup_info.hStdError:
            si.hStdError = int(startup_info.hStdError)

    pi = _PROCESS_INFORMATION()

    if env is not None:
        envbuf = ""
        for k, v in env.iteritems():
            envbuf += "%s=%s\0" % (k, v)
        envbuf += '\0'
    else:
        envbuf = None

    res = _CreateProcess(name, command_line, None, None, inherit, flags,
                         envbuf, start_dir, _byref(si), _byref(pi))

    if not res:
        raise _WinError()

    return _handle(pi.hProcess), _handle(
        pi.hThread), pi.dwProcessID, pi.dwThreadID
コード例 #4
0
ファイル: _subprocess.py プロジェクト: Qointum/pypy
def CreateProcess(name, command_line, process_attr, thread_attr,
                  inherit, flags, env, start_dir, startup_info):
    si = _STARTUPINFO()
    if startup_info is not None:
        si.dwFlags = startup_info.dwFlags
        si.wShowWindow = startup_info.wShowWindow
        if startup_info.hStdInput:
            si.hStdInput = int(startup_info.hStdInput)
        if startup_info.hStdOutput:
            si.hStdOutput = int(startup_info.hStdOutput)
        if startup_info.hStdError:
            si.hStdError = int(startup_info.hStdError)

    pi = _PROCESS_INFORMATION()
    flags |= CREATE_UNICODE_ENVIRONMENT

    if env is not None:
        envbuf = ""
        for k, v in env.items():
            envbuf += "%s=%s\0" % (k, v)
        envbuf += '\0'
    else:
        envbuf = None

    res = _CreateProcess(name, command_line, None, None, inherit, flags, envbuf,
                        start_dir, _byref(si), _byref(pi))

    if not res:
        raise _WinError()

    return _handle(pi.hProcess), _handle(pi.hThread), pi.dwProcessID, pi.dwThreadID
コード例 #5
0
ファイル: _subprocess.py プロジェクト: cavr/MongoCourse
def GetExitCodeProcess(handle):
    code = _c_int()

    res = _GetExitCodeProcess(int(handle), _byref(code))

    if not res:
        raise _WinError()

    return code.value
コード例 #6
0
ファイル: _subprocess.py プロジェクト: Qointum/pypy
def GetExitCodeProcess(handle):
    code = _c_int()

    res = _GetExitCodeProcess(int(handle), _byref(code))

    if not res:
        raise _WinError()

    return code.value
コード例 #7
0
ファイル: _subprocess.py プロジェクト: cavr/MongoCourse
def CreatePipe(attributes, size):
    read = _c_int()
    write = _c_int()

    res = _CreatePipe(_byref(read), _byref(write), None, size)

    if not res:
        raise _WinError()

    return _handle(read.value), _handle(write.value)
コード例 #8
0
ファイル: _subprocess.py プロジェクト: Qointum/pypy
def CreatePipe(attributes, size):
    read = _c_int()
    write = _c_int()

    res = _CreatePipe(_byref(read), _byref(write), None, size)

    if not res:
        raise _WinError()

    return _handle(read.value), _handle(write.value)
コード例 #9
0
ファイル: _subprocess.py プロジェクト: Qointum/pypy
def DuplicateHandle(source_process, source, target_process, access, inherit, options=0):
    target = _c_int()

    res = _DuplicateHandle(int(source_process), int(source), int(target_process),
                           _byref(target),
                           access, inherit, options)

    if not res:
        raise _WinError()

    return _handle(target.value)
コード例 #10
0
ファイル: _subprocess.py プロジェクト: cavr/MongoCourse
def DuplicateHandle(source_process,
                    source,
                    target_process,
                    access,
                    inherit,
                    options=0):
    target = _c_int()

    res = _DuplicateHandle(int(source_process), int(source),
                           int(target_process), _byref(target), access,
                           inherit, options)

    if not res:
        raise _WinError()

    return _handle(target.value)
コード例 #11
0
ファイル: _subprocess.py プロジェクト: cavr/MongoCourse
def TerminateProcess(handle, exitcode):
    res = _TerminateProcess(int(handle), exitcode)

    if not res:
        raise _WinError()
コード例 #12
0
ファイル: _subprocess.py プロジェクト: Qointum/pypy
def TerminateProcess(handle, exitcode):
    res = _TerminateProcess(int(handle), exitcode)

    if not res:
        raise _WinError()