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

Function _execvpe

tools/python-3.11.9-amd64/Lib/os.py:587–616  ·  view source on GitHub ↗
(file, args, env=None)

Source from the content-addressed store, hash-verified

585__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
586
587def _execvpe(file, args, env=None):
588 if env is not None:
589 exec_func = execve
590 argrest = (args, env)
591 else:
592 exec_func = execv
593 argrest = (args,)
594 env = environ
595
596 if path.dirname(file):
597 exec_func(file, *argrest)
598 return
599 saved_exc = None
600 path_list = get_exec_path(env)
601 if name != 'nt':
602 file = fsencode(file)
603 path_list = map(fsencode, path_list)
604 for dir in path_list:
605 fullname = path.join(dir, file)
606 try:
607 exec_func(fullname, *argrest)
608 except (FileNotFoundError, NotADirectoryError) as e:
609 last_exc = e
610 except OSError as e:
611 last_exc = e
612 if saved_exc is None:
613 saved_exc = e
614 if saved_exc is not None:
615 raise saved_exc
616 raise last_exc
617
618
619def get_exec_path(env=None):

Callers 2

execvpFunction · 0.85
execvpeFunction · 0.85

Calls 4

get_exec_pathFunction · 0.85
fsencodeFunction · 0.70
mapFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected