MCPcopy Index your code
hub / github.com/python/cpython / _spawnvef

Function _spawnvef

Lib/os.py:911–936  ·  view source on GitHub ↗
(mode, file, args, env, func)

Source from the content-addressed store, hash-verified

909 # as execv*()?
910
911 def _spawnvef(mode, file, args, env, func):
912 # Internal helper; func is the exec*() function to use
913 if not isinstance(args, (tuple, list)):
914 raise TypeError('argv must be a tuple or a list')
915 if not args or not args[0]:
916 raise ValueError('argv first element cannot be empty')
917 pid = fork()
918 if not pid:
919 # Child
920 try:
921 if env is None:
922 func(file, args)
923 else:
924 func(file, args, env)
925 except:
926 _exit(127)
927 else:
928 # Parent
929 if mode == P_NOWAIT:
930 return pid # Caller is responsible for waiting!
931 while 1:
932 wpid, sts = waitpid(pid, 0)
933 if WIFSTOPPED(sts):
934 continue
935
936 return waitstatus_to_exitcode(sts)
937
938 def spawnv(mode, file, args):
939 """spawnv(mode, file, args) -> integer

Callers 4

spawnvFunction · 0.85
spawnveFunction · 0.85
spawnvpFunction · 0.85
spawnvpeFunction · 0.85

Calls 4

_exitFunction · 0.90
forkFunction · 0.85
waitstatus_to_exitcodeFunction · 0.85
funcFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…