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

Function _execvpe

Lib/os.py:630–659  ·  view source on GitHub ↗
(file, args, env=None)

Source from the content-addressed store, hash-verified

628__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
629
630def _execvpe(file, args, env=None):
631 if env is not None:
632 exec_func = execve
633 argrest = (args, env)
634 else:
635 exec_func = execv
636 argrest = (args,)
637 env = environ
638
639 if path.dirname(file):
640 exec_func(file, *argrest)
641 return
642 saved_exc = None
643 path_list = get_exec_path(env)
644 if name != 'nt':
645 file = fsencode(file)
646 path_list = map(fsencode, path_list)
647 for dir in path_list:
648 fullname = path.join(dir, file)
649 try:
650 exec_func(fullname, *argrest)
651 except (FileNotFoundError, NotADirectoryError) as e:
652 last_exc = e
653 except OSError as e:
654 last_exc = e
655 if saved_exc is None:
656 saved_exc = e
657 if saved_exc is not None:
658 raise saved_exc
659 raise last_exc
660
661
662def get_exec_path(env=None):

Callers 2

execvpFunction · 0.85
execvpeFunction · 0.85

Calls 4

get_exec_pathFunction · 0.85
fsencodeFunction · 0.85
dirnameMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…