MCPcopy
hub / github.com/pex-tool/pex / run

Method run

pex/pex.py:865–897  ·  view source on GitHub ↗

Run the PythonEnvironment in an interpreter in a subprocess. :keyword args: Additional arguments to be passed to the application being invoked by the environment. :keyword with_chroot: Run with cwd set to the environment's working directory. :keyword blocking: If t

(self, args=(), with_chroot=False, blocking=True, setsid=False, env=None, **kwargs)

Source from the content-addressed store, hash-verified

863 return cmd
864
865 def run(self, args=(), with_chroot=False, blocking=True, setsid=False, env=None, **kwargs):
866 """Run the PythonEnvironment in an interpreter in a subprocess.
867
868 :keyword args: Additional arguments to be passed to the application being invoked by the
869 environment.
870 :keyword with_chroot: Run with cwd set to the environment's working directory.
871 :keyword blocking: If true, return the return code of the subprocess.
872 If false, return the Popen object of the invoked subprocess.
873 :keyword setsid: If true, run the PEX in a separate operating system session.
874 :keyword env: An optional environment dict to use as the PEX subprocess environment. If none is
875 passed, the ambient environment is inherited.
876 Remaining keyword arguments are passed directly to subprocess.Popen.
877 """
878 if env is not None:
879 # If explicit env vars are passed, we don't want to clean any of these.
880 env = env.copy()
881 else:
882 env = os.environ.copy()
883 self._clean_environment(env=env, strip_pex_env=self._pex_info.strip_pex_env)
884
885 kwargs = dict(subprocess_daemon_kwargs() if setsid else {}, **kwargs)
886
887 TRACER.log("PEX.run invoking {}".format(" ".join(self.cmdline(args))))
888 _, process = self._interpreter.open_process(
889 [self._pex] + list(args),
890 cwd=self._pex if with_chroot else os.getcwd(),
891 stdin=kwargs.pop("stdin", None),
892 stdout=kwargs.pop("stdout", None),
893 stderr=kwargs.pop("stderr", None),
894 env=env,
895 **kwargs
896 )
897 return process.wait() if blocking else process
898
899
900def validate_entry_point(

Callers 15

do_mainFunction · 0.95
run_simple_pexFunction · 0.95
build_cache_imageFunction · 0.45
mainFunction · 0.45
execute_pagefindFunction · 0.45
execute_sphinx_buildFunction · 0.45
run_blackFunction · 0.45
run_isortFunction · 0.45
find_repo_rootFunction · 0.45

Calls 9

_clean_environmentMethod · 0.95
cmdlineMethod · 0.95
subprocess_daemon_kwargsFunction · 0.90
logMethod · 0.80
copyMethod · 0.45
joinMethod · 0.45
open_processMethod · 0.45
popMethod · 0.45
waitMethod · 0.45