MCPcopy Index your code
hub / github.com/RustPython/RustPython / _execvpe

Function _execvpe

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

Source from the content-addressed store, hash-verified

615__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
616
617def _execvpe(file, args, env=None):
618 if env is not None:
619 exec_func = execve
620 argrest = (args, env)
621 else:
622 exec_func = execv
623 argrest = (args,)
624 env = environ
625
626 if path.dirname(file):
627 exec_func(file, *argrest)
628 return
629 saved_exc = None
630 path_list = get_exec_path(env)
631 if name != 'nt':
632 file = fsencode(file)
633 path_list = map(fsencode, path_list)
634 for dir in path_list:
635 fullname = path.join(dir, file)
636 try:
637 exec_func(fullname, *argrest)
638 except (FileNotFoundError, NotADirectoryError) as e:
639 last_exc = e
640 except OSError as e:
641 last_exc = e
642 if saved_exc is None:
643 saved_exc = e
644 if saved_exc is not None:
645 raise saved_exc
646 raise last_exc
647
648
649def get_exec_path(env=None):

Callers 2

execvpFunction · 0.85
execvpeFunction · 0.85

Calls 3

get_exec_pathFunction · 0.85
fsencodeFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected