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

Function run_simple_pex

testing/__init__.py:601–619  ·  view source on GitHub ↗
(
    pex,  # type: str
    args=(),  # type: Iterable[str]
    interpreter=None,  # type: Optional[PythonInterpreter]
    stdin=None,  # type: Optional[bytes]
    **kwargs  # type: Any
)

Source from the content-addressed store, hash-verified

599
600
601def run_simple_pex(
602 pex, # type: str
603 args=(), # type: Iterable[str]
604 interpreter=None, # type: Optional[PythonInterpreter]
605 stdin=None, # type: Optional[bytes]
606 **kwargs # type: Any
607):
608 # type: (...) -> Tuple[bytes, int]
609 p = PEX(pex, interpreter=interpreter)
610 process = p.run(
611 args=args,
612 blocking=False,
613 stdin=subprocess.PIPE,
614 stdout=subprocess.PIPE,
615 stderr=kwargs.pop("stderr", subprocess.STDOUT),
616 **kwargs
617 )
618 stdout, _ = process.communicate(input=stdin)
619 return stdout.replace(b"\r", b""), process.returncode
620
621
622def run_simple_pex_test(

Calls 4

runMethod · 0.95
PEXClass · 0.90
communicateMethod · 0.80
popMethod · 0.45