本文整理汇总了Python中msvcrt.get_osfhandle函数的典型用法代码示例。如果您正苦于以下问题:Python get_osfhandle函数的具体用法?Python get_osfhandle怎么用?Python get_osfhandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_osfhandle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _mk_inheritable
def _mk_inheritable(fd):
if version >= (3, 3):
if sys.platform == 'win32':
# Change to Windwos file handle
import msvcrt
fdh = msvcrt.get_osfhandle(fd)
os.set_handle_inheritable(fdh, True)
return fdh
else:
os.set_inheritable(fd, True)
return fd
elif sys.platform == 'win32':
# TODO: find a hack??
# Not yet working
import msvcrt
import _subprocess
curproc = _subprocess.GetCurrentProcess()
fdh = msvcrt.get_osfhandle(fd)
fdh = _subprocess.DuplicateHandle(
curproc, fdh, curproc, 0,
True, # set inheritable FLAG
_subprocess.DUPLICATE_SAME_ACCESS)
return fdh
else:
return fd
开发者ID:tomMoral,项目名称:multiprocess_backend,代码行数:26,代码来源:process_popen.py
示例2: _checkFileObjInheritable
def _checkFileObjInheritable(cls, fileobj, handle_name):
"""Check if a given file-like object (or whatever else subprocess.Popen
takes as a handle/stream) can be correctly inherited by a child process.
This just duplicates the code in subprocess.Popen._get_handles to make
sure we go down the correct code path; this to catch some non-standard
corner cases."""
import _subprocess
import ctypes
import msvcrt
new_handle = None
try:
if fileobj is None:
handle = _subprocess.GetStdHandle(getattr(_subprocess,
handle_name))
if handle is None:
return True # No need to check things we create
elif fileobj == subprocess.PIPE:
return True # No need to check things we create
elif isinstance(fileobj, int):
handle = msvcrt.get_osfhandle(fileobj)
else:
# Assuming file-like object
handle = msvcrt.get_osfhandle(fileobj.fileno())
new_handle = self._make_inheritable(handle)
return True
except:
return False
finally:
CloseHandle = ctypes.windll.kernel32.CloseHandle
if new_handle is not None:
CloseHandle(new_handle)
开发者ID:13767870821,项目名称:SublimeCodeIntel,代码行数:31,代码来源:process.py
示例3: read_bytes
def read_bytes(self, buffer_size=4096):
out = self.popen.stdout
if POSIX:
while True:
i, _, _ = select.select([out], [], [])
if i:
return out.read(buffer_size)
else:
import ctypes
import msvcrt
kernel32 = ctypes.windll.kernel32
buffer_size = 1
bytes_read = bytearray()
#wait for some output synchronously, to not cause infinite loop
bytes_read.extend(out.read(buffer_size))
#read until end of current output
kernel32.SetNamedPipeHandleState(ctypes.c_void_p(msvcrt.get_osfhandle(out.fileno())), ctypes.byref(ctypes.c_int(1)), None, None)
#'Invalid Argument' means that there are no more bytes left to read
while True:
try:
cur_bytes_read=out.read(buffer_size)
if not cur_bytes_read:
break
bytes_read.extend(cur_bytes_read)
except (OSError, IOError):
break
kernel32.SetNamedPipeHandleState(ctypes.c_void_p(msvcrt.get_osfhandle(out.fileno())), ctypes.byref(ctypes.c_int(0)), None, None)
# f'in HACK, for \r\n -> \n translation on windows
# I tried universal_endlines but it was pain and misery! :'(
return bytes_read.replace(b'\r\n', b'\n')
开发者ID:Drllap,项目名称:SublimeREPL,代码行数:34,代码来源:subprocess_repl.py
示例4: _create_tmp_files
def _create_tmp_files(env=None):
dirname = None
if env is None:
env = os.environ
for env_var_name in 'TMPDIR', 'TEMP', 'TMP':
if env.has_key(env_var_name):
dirname = env[env_var_name]
if dirname and os.path.exists(dirname):
break
if dirname is None:
for dirname2 in r'c:\temp', r'c:\tmp', r'\temp', r'\tmp':
try:
os.makedirs(dirname2)
dirname = dirname2
break
except:
pass
if dirname is None:
raise Exception('Unable to create temp dir. Insufficient access rights.')
out_file = tempfile.TemporaryFile(mode="r+b", dir=dirname)
err_file = tempfile.TemporaryFile(mode="r+b", dir=dirname)
return (msvcrt.get_osfhandle(out_file.fileno()),
msvcrt.get_osfhandle(err_file.fileno()),
out_file,
err_file)
开发者ID:OpenPOWER-BigData,项目名称:HDP-ambari,代码行数:29,代码来源:system.py
示例5: __init__
def __init__( self, *args, **kwargs ):
"""
Both output streams stdout and stderr can be set to any object
that has a write function. Leaving stdout or stderr out will
redirect both streams to their system equivalent (sys.stdout and
sys.stderr).
"""
self._bypass_stdout = False
self._bypass_stderr = False
if 'stdout' in kwargs and not kwargs['stdout'] is subprocess.PIPE:
self._stdout_file = kwargs['stdout']
kwargs['stdout'] = subprocess.PIPE
self._bypass_stdout = True
elif not 'stdout' in kwargs:
self._stdout_file = sys.stdout
kwargs['stdout'] = subprocess.PIPE
self._bypass_stdout = True
if 'stderr' in kwargs and not kwargs['stderr'] is subprocess.PIPE:
self._stderr_file = kwargs['stderr']
kwargs['stderr'] = subprocess.PIPE
self._bypass_stderr = True
elif not 'stderr' in kwargs:
self._stderr_file = sys.stderr
kwargs['stderr'] = subprocess.PIPE
self._bypass_stderr = True
subprocess.Popen.__init__( self, *args, **kwargs )
if self._bypass_stdout:
self._stdout_hdl = msvcrt.get_osfhandle( self.stdout.fileno() )
if self._bypass_stderr:
self._stderr_hdl = msvcrt.get_osfhandle( self.stderr.fileno() )
开发者ID:KDE,项目名称:emerge-history,代码行数:34,代码来源:tools.py
示例6: _create_tmp_files
def _create_tmp_files():
out_file = tempfile.TemporaryFile(mode="r+b")
err_file = tempfile.TemporaryFile(mode="r+b")
return (msvcrt.get_osfhandle(out_file.fileno()),
msvcrt.get_osfhandle(err_file.fileno()),
out_file,
err_file)
开发者ID:maduhu,项目名称:HDP2.5-ambari,代码行数:7,代码来源:os_windows.py
示例7: __init__
def __init__ (self, executable, args, env, logfile=None):
self.logfile = logfile
self.executable = find_executable(executable)
self.args = args
self.exitstatus = None
self.running = 0
tempfile.template = None
if logfile:
fd = os.open(logfile.filename,
O_WRONLY | O_CREAT | O_APPEND, 0664)
# Get the NT handle for fd
hStdout = msvcrt.get_osfhandle(fd)
# Equivalent of os.dup() except for Win32 HANDLE's
hStderr = win32api.DuplicateHandle(hStdout)
else:
# Grab the HANDLE's for current stdout & stderr
hStdout = msvcrt.get_osfhandle(sys.stdout)
hStderr = msvcrt.get_osfhandle(sys.stderr)
# Grab the HANDLE for stdin
hStdin = msvcrt.get_osfhandle(sys.stdin)
for key in env.keys():
os.environ[key] = env[key]
if logfile:
output = fd
else:
output = sys.stderr
output.write("executable is " +
str(self.executable) +
", args are " +
str(args) + ", env = " +
str(os.environ) + "\n")
# Create the process
# All of this footwork, should allow this sucker to run from a console, or GUI app.
sCmdLine = self.executable
for arg in args:
sCmdLine = sCmdLine + " " + arg
StartupInfo = win32process.STARTUPINFO()
StartupInfo.dwFlags = win32con.STARTF_USESTDHANDLES | win32con.STARTF_USESHOWWINDOW
StartupInfo.hStdInput = hStdin
StartupInfo.hStdOutput = hStdout
StartupInfo.hStdError = hStderr
StartupInfo.wShowWindow = win32con.SW_HIDE
hProcess, hThread, dwPid, dwTid = win32api.CreateProcess(self.executable,
sCmdLine,
None,
None,
0,
win32process.CREATE_NEW_CONSOLE,
None,
None,
StartupInfo)
win32api.CloseHandle(hThread)
self.pid = dwPid
self.hProcess = hProcess
self.running = 1
add_exit_function(lambda x=self: x.kill())
开发者ID:spchamp,项目名称:ilu,代码行数:56,代码来源:ProcessWin32.py
示例8: __init__
def __init__(self, incoming, outgoing):
import msvcrt
self._keepalive = (incoming, outgoing)
if hasattr(incoming, "fileno"):
self._fileno = incoming.fileno()
incoming = msvcrt.get_osfhandle(incoming.fileno())
if hasattr(outgoing, "fileno"):
outgoing = msvcrt.get_osfhandle(outgoing.fileno())
self.incoming = incoming
self.outgoing = outgoing
开发者ID:pombredanne,项目名称:rpyc,代码行数:10,代码来源:stream.py
示例9: _isFileObjInheritable
def _isFileObjInheritable(cls, fileobj, stream_name):
"""Check if a given file-like object (or whatever else subprocess.Popen
takes as a handle/stream) can be correctly inherited by a child process.
This just duplicates the code in subprocess.Popen._get_handles to make
sure we go down the correct code path; this to catch some non-standard
corner cases.
@param fileobj The object being used as a fd/handle/whatever
@param stream_name The name of the stream, "stdin", "stdout", or "stderr"
"""
import _subprocess
import ctypes
import msvcrt
new_handle = None
# Things that we know how to reset (i.e. not custom fds)
valid_list = {
"stdin": (sys.stdin, sys.__stdin__, 0),
"stdout": (sys.stdout, sys.__stdout__, 1),
"stderr": (sys.stderr, sys.__stderr__, 2),
}[stream_name]
try:
if fileobj is None:
std_handle = {
"stdin": _subprocess.STD_INPUT_HANDLE,
"stdout": _subprocess.STD_OUTPUT_HANDLE,
"stderr": _subprocess.STD_ERROR_HANDLE,
}[stream_name]
handle = _subprocess.GetStdHandle(std_handle)
if handle is None:
# subprocess.Popen._get_handles creates a new pipe here
# we don't have to worry about things we create
return True
elif fileobj == subprocess.PIPE:
# We're creating a new pipe; newly created things are inheritable
return True
elif fileobj not in valid_list:
# We are trying to use a custom fd; don't do anything fancy here,
# we don't want to actually use subprocess.PIPE
return True
elif isinstance(fileobj, int):
handle = msvcrt.get_osfhandle(fileobj)
else:
# Assuming file-like object
handle = msvcrt.get_osfhandle(fileobj.fileno())
new_handle = self._make_inheritable(handle)
return True
except:
return False
finally:
CloseHandle = ctypes.windll.kernel32.CloseHandle
if new_handle is not None:
CloseHandle(new_handle)
开发者ID:Acidburn0zzz,项目名称:KomodoEdit,代码行数:54,代码来源:process.py
示例10: _get_handles
def _get_handles(self, stdin, stdout, stderr):
if stdin is None and stdout is None and stderr is None:
return (-1, -1, -1, -1, -1, -1)
(p2cread, p2cwrite) = (-1, -1)
(c2pread, c2pwrite) = (-1, -1)
(errread, errwrite) = (-1, -1)
if stdin is None:
p2cread = _winapi.GetStdHandle(_winapi.STD_INPUT_HANDLE)
(p2cread, _) = _winapi.CreatePipe(None, 0)
p2cread = Handle(p2cread)
_winapi.CloseHandle(_)
elif stdin == PIPE:
(p2cread, p2cwrite) = _winapi.CreatePipe(None, 0)
(p2cread, p2cwrite) = (Handle(p2cread), Handle(p2cwrite))
elif stdin == DEVNULL:
p2cread = msvcrt.get_osfhandle(self._get_devnull())
elif isinstance(stdin, int):
p2cread = msvcrt.get_osfhandle(stdin)
else:
p2cread = msvcrt.get_osfhandle(stdin.fileno())
p2cread = self._make_inheritable(p2cread)
if stdout is None:
c2pwrite = _winapi.GetStdHandle(_winapi.STD_OUTPUT_HANDLE)
(_, c2pwrite) = _winapi.CreatePipe(None, 0)
c2pwrite = Handle(c2pwrite)
_winapi.CloseHandle(_)
elif stdout == PIPE:
(c2pread, c2pwrite) = _winapi.CreatePipe(None, 0)
(c2pread, c2pwrite) = (Handle(c2pread), Handle(c2pwrite))
elif stdout == DEVNULL:
c2pwrite = msvcrt.get_osfhandle(self._get_devnull())
elif isinstance(stdout, int):
c2pwrite = msvcrt.get_osfhandle(stdout)
else:
c2pwrite = msvcrt.get_osfhandle(stdout.fileno())
c2pwrite = self._make_inheritable(c2pwrite)
if stderr is None:
errwrite = _winapi.GetStdHandle(_winapi.STD_ERROR_HANDLE)
(_, errwrite) = _winapi.CreatePipe(None, 0)
errwrite = Handle(errwrite)
_winapi.CloseHandle(_)
elif stderr == PIPE:
(errread, errwrite) = _winapi.CreatePipe(None, 0)
(errread, errwrite) = (Handle(errread), Handle(errwrite))
elif stderr == STDOUT:
errwrite = c2pwrite
elif stderr == DEVNULL:
errwrite = msvcrt.get_osfhandle(self._get_devnull())
elif isinstance(stderr, int):
errwrite = msvcrt.get_osfhandle(stderr)
else:
errwrite = msvcrt.get_osfhandle(stderr.fileno())
errwrite = self._make_inheritable(errwrite)
return (p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:54,代码来源:subprocess.py
示例11: recv_multi_impl
def recv_multi_impl(conns, maxsize, timeout):
"""Reads from the first available pipe.
If timeout is None, it's blocking. If timeout is 0, it is not blocking.
"""
# TODO(maruel): Use WaitForMultipleObjects(). Python creates anonymous pipes
# for proc.stdout and proc.stderr but they are implemented as named pipes on
# Windows. Since named pipes are not waitable object, they can't be passed
# as-is to WFMO(). So this means N times CreateEvent(), N times ReadFile()
# and finally WFMO(). This requires caching the events handles in the Popen
# object and remembering the pending ReadFile() calls. This will require
# some re-architecture to store the relevant event handle and OVERLAPPEDIO
# object in Popen or the file object.
maxsize = max(maxsize or 16384, 1)
if timeout:
start = time.time()
handles = [
(i, msvcrt.get_osfhandle(c.fileno())) for i, c in enumerate(conns)
]
while handles:
for index, handle in handles:
try:
avail = min(PeekNamedPipe(handle), maxsize)
if avail:
return index, ReadFile(handle, avail)[1]
if (timeout and (time.time() - start) >= timeout) or timeout == 0:
return None, None
# Polling rocks.
time.sleep(0.001)
except OSError:
handles.remove((index, handle))
break
# Nothing to wait for.
return None, None
开发者ID:WHS-TechOps,项目名称:Aviator,代码行数:34,代码来源:subprocess42.py
示例12: unlock
def unlock(file):
hfile = msvcrt.get_osfhandle(file.fileno())
overlapped = OVERLAPPED()
if UnlockFileEx(hfile, 0, 0, 0xFFFF0000, ctypes.byref(overlapped)):
return True
else:
return False
开发者ID:roundup-tracker,项目名称:roundup,代码行数:7,代码来源:portalocker.py
示例13: readpipeNONBLK
def readpipeNONBLK(self, cmdpipe):
#
# Don't block waiting for output to appear, just grab
# whatever is available now on the pipe. fstat on
# bsd unix pipes gives the available-to-read count.
# But doesn't work on linux, or on win32 CreatePipe
# anonymous pipes (purportedly works on win32 posix pipes).
#
bytes = ""
try:
# anything available to read right now?
nAvail = 0
x = cmdpipe.fileno()
if subprocess.mswindows:
h = msvcrt.get_osfhandle(x)
dword = ctypes.c_ulong()
rc = ctypes.windll.kernel32.PeekNamedPipe(
h, None, 0, None, ctypes.byref(dword), None
)
if rc:
nAvail = int(dword.value)
else:
#unix
# unfortunately, the os.fstat trick doesn't work on linux
# nAvail = os.fstat(x).st_size
# whereas the select "poll" seems to work on all *nix
if select.select([cmdpipe], [], [], 0)[0]:
nAvail = 262144
if nAvail > 0:
bytes = os.read(x,nAvail)
except Exception:
pass
return bytes
开发者ID:utsdab,项目名称:usr,代码行数:35,代码来源:TrSubprocess.py
示例14: _check_ready
def _check_ready(self, conn, maxsize=1024):
if maxsize < 1:
maxsize = 1
if conn is None:
return
try:
x = msvcrt.get_osfhandle(conn.fileno())
(read, nAvail, nMessage) = PeekNamedPipe(x, 0)
if maxsize < nAvail:
nAvail = maxsize
if nAvail > 0:
if conn is self.stdout:
self.emit('stdout-ready')
elif conn is self.stderr:
self.emit('stderr-ready')
except ValueError:
return conn.close()
except (WindowsError, Exception) as ex:
if ex[0] in (109, errno.ESHUTDOWN):
return conn.close()
raise
return True
开发者ID:avalentino,项目名称:gsdview,代码行数:25,代码来源:gtk.py
示例15: _connect_stdio
def _connect_stdio(self):
if os.name == 'nt':
pipe = PipeHandle(msvcrt.get_osfhandle(sys.stdin.fileno()))
else:
pipe = sys.stdin
coroutine = self._loop.connect_read_pipe(self._fact, pipe)
self._loop.run_until_complete(coroutine)
debug("native stdin connection successful")
if os.name == 'nt':
pipe = PipeHandle(msvcrt.get_osfhandle(sys.stdout.fileno()))
else:
pipe = sys.stdout
coroutine = self._loop.connect_write_pipe(self._fact, pipe)
self._loop.run_until_complete(coroutine)
debug("native stdout connection successful")
开发者ID:mhinz,项目名称:python-client,代码行数:16,代码来源:asyncio.py
示例16: _crashHandler
def _crashHandler(exceptionInfo):
threadId = ctypes.windll.kernel32.GetCurrentThreadId()
# An exception might have been set for this thread.
# Clear it so that it doesn't get raised in this function.
ctypes.pythonapi.PyThreadState_SetAsyncExc(threadId, None)
# Write a minidump.
dumpPath = os.path.abspath(os.path.join(globalVars.appArgs.logFileName, "..", "nvda_crash.dmp"))
try:
with file(dumpPath, "w") as mdf:
mdExc = MINIDUMP_EXCEPTION_INFORMATION(ThreadId=threadId,
ExceptionPointers=exceptionInfo, ClientPointers=False)
if not ctypes.windll.DbgHelp.MiniDumpWriteDump(
ctypes.windll.kernel32.GetCurrentProcess(),
os.getpid(),
msvcrt.get_osfhandle(mdf.fileno()),
0, # MiniDumpNormal
ctypes.byref(mdExc),
None,
None
):
raise ctypes.WinError()
except:
log.critical("NVDA crashed! Error writing minidump", exc_info=True)
else:
log.critical("NVDA crashed! Minidump written to %s" % dumpPath)
log.info("Restarting due to crash")
core.restart()
return 1 # EXCEPTION_EXECUTE_HANDLER
开发者ID:lpintes,项目名称:NVDA,代码行数:30,代码来源:watchdog.py
示例17: readWithTimeout
def readWithTimeout(self, f, timeout):
"""
Try to read a line of output from the file object |f|. |f| must be a
pipe, like the |stdout| member of a subprocess.Popen object created
with stdout=PIPE. Returns a tuple (line, did_timeout), where |did_timeout|
is True if the read timed out, and False otherwise. If no output is
received within |timeout| seconds, returns a blank line.
"""
if timeout is None:
timeout = 0
x = msvcrt.get_osfhandle(f.fileno())
l = ctypes.c_long()
done = time.time() + timeout
buffer = ""
while timeout == 0 or time.time() < done:
if self.PeekNamedPipe(x, None, 0, None, ctypes.byref(l), None) == 0:
err = self.GetLastError()
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
return ("", False)
else:
self.log.error("readWithTimeout got error: %d", err)
# read a character at a time, checking for eol. Return once we get there.
index = 0
while index < l.value:
char = f.read(1)
buffer += char
if char == "\n":
return (buffer, False)
index = index + 1
time.sleep(0.01)
return (buffer, True)
开发者ID:vladikoff,项目名称:fxa-mochitest,代码行数:34,代码来源:automation.py
示例18: __init__
def __init__(self, stream):
self.stream = stream or sys.stdout
self.isatty = getattr(self.stream, 'isatty', lambda : False)()
force_ansi = 'CALIBRE_FORCE_ANSI' in os.environ
if not self.isatty and force_ansi:
self.isatty = True
self.isansi = force_ansi or not iswindows
self.set_console = self.write_console = None
self.is_console = False
if not self.isansi:
try:
import msvcrt
self.msvcrt = msvcrt
self.file_handle = msvcrt.get_osfhandle(self.stream.fileno())
from ctypes import windll, wintypes, byref, POINTER, WinDLL
mode = wintypes.DWORD(0)
f = windll.kernel32.GetConsoleMode
f.argtypes, f.restype = [wintypes.HANDLE, POINTER(wintypes.DWORD)], wintypes.BOOL
if f(self.file_handle, byref(mode)):
# Stream is a console
self.set_console = windll.kernel32.SetConsoleTextAttribute
self.default_console_text_attributes = WCOLORS['white']
kernel32 = WinDLL(native_string_type('kernel32'), use_last_error=True)
self.write_console = kernel32.WriteConsoleW
self.write_console.argtypes = [wintypes.HANDLE, wintypes.c_wchar_p, wintypes.DWORD, POINTER(wintypes.DWORD), wintypes.LPVOID]
self.write_console.restype = wintypes.BOOL
kernel32.GetConsoleScreenBufferInfo.argtypes = [wintypes.HANDLE, ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO)]
kernel32.GetConsoleScreenBufferInfo.restype = wintypes.BOOL
csbi = CONSOLE_SCREEN_BUFFER_INFO()
if kernel32.GetConsoleScreenBufferInfo(self.file_handle, byref(csbi)):
self.default_console_text_attributes = csbi.wAttributes
self.is_console = True
except:
pass
开发者ID:JimmXinu,项目名称:calibre,代码行数:34,代码来源:terminal.py
示例19: __init__
def __init__(self, process_obj):
cmd = ' '.join('"%s"' % x for x in get_command_line())
prep_data = get_preparation_data(process_obj._name)
# create pipe for communication with child
rfd, wfd = os.pipe()
# get handle for read end of the pipe and make it inheritable
rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True)
os.close(rfd)
with open(wfd, 'wb', closefd=True) as to_child:
# start process
try:
hp, ht, pid, tid = _winapi.CreateProcess(
_python_exe, cmd + (' %s' % rhandle),
None, None, 1, 0, None, None, None
)
_winapi.CloseHandle(ht)
finally:
close(rhandle)
# set attributes of self
self.pid = pid
self.returncode = None
self._handle = hp
self.sentinel = int(hp)
# send information to child
Popen._tls.process_handle = int(hp)
try:
dump(prep_data, to_child, HIGHEST_PROTOCOL)
dump(process_obj, to_child, HIGHEST_PROTOCOL)
finally:
del Popen._tls.process_handle
开发者ID:pombredanne,项目名称:cpython-1,代码行数:35,代码来源:forking.py
示例20: __init__
def __init__(self, process_obj):
# create pipe for communication with child
r, w = os.pipe()
# get handle for read end of the pipe and make it inheritable
rhandle = msvcrt.get_osfhandle(r)
win32.SetHandleInformation(rhandle, win32.HANDLE_FLAG_INHERIT, win32.HANDLE_FLAG_INHERIT)
# start process
cmd = getCommandLine() + [rhandle]
cmd = " ".join('"%s"' % x for x in cmd)
hp, ht, pid, tid = _subprocess.CreateProcess(sys.executable, cmd, None, None, 1, 0, None, None, None)
os.close(r)
ht.Close()
# set attributes of self
self.pid = pid
self.returncode = None
self._handle = hp
# send information to child
prep_data = getPreparationData(process_obj._name)
to_child = os.fdopen(w, "wb")
tls.is_spawning = True
try:
dump(prep_data, to_child, HIGHEST_PROTOCOL)
dump(process_obj, to_child, HIGHEST_PROTOCOL)
finally:
tls.is_spawning = False
to_child.close()
开发者ID:ximumu,项目名称:multiprocess,代码行数:30,代码来源:forking.py
注:本文中的msvcrt.get_osfhandle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论