MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _spawnvef

Function _spawnvef

tools/python-3.11.9-amd64/Lib/os.py:847–872  ·  view source on GitHub ↗
(mode, file, args, env, func)

Source from the content-addressed store, hash-verified

845 # as execv*()?
846
847 def _spawnvef(mode, file, args, env, func):
848 # Internal helper; func is the exec*() function to use
849 if not isinstance(args, (tuple, list)):
850 raise TypeError('argv must be a tuple or a list')
851 if not args or not args[0]:
852 raise ValueError('argv first element cannot be empty')
853 pid = fork()
854 if not pid:
855 # Child
856 try:
857 if env is None:
858 func(file, args)
859 else:
860 func(file, args, env)
861 except:
862 _exit(127)
863 else:
864 # Parent
865 if mode == P_NOWAIT:
866 return pid # Caller is responsible for waiting!
867 while 1:
868 wpid, sts = waitpid(pid, 0)
869 if WIFSTOPPED(sts):
870 continue
871
872 return waitstatus_to_exitcode(sts)
873
874 def spawnv(mode, file, args):
875 """spawnv(mode, file, args) -> integer

Callers 4

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

Calls 3

_exitFunction · 0.90
forkFunction · 0.85
waitstatus_to_exitcodeFunction · 0.85

Tested by

no test coverage detected