(
pex, # type: str
*extra_pex_args # type: str
)
| 87 | build_pex_args.append("--venv") |
| 88 | |
| 89 | def grab_ps( |
| 90 | pex, # type: str |
| 91 | *extra_pex_args # type: str |
| 92 | ): |
| 93 | # type: (...) -> Tuple[Text, Text] |
| 94 | run_pex_command(args=build_pex_args + ["-o", pex] + list(extra_pex_args)).assert_success() |
| 95 | |
| 96 | process = subprocess.Popen(args=[sys.executable, pex, "--some", "arguments", "here"]) |
| 97 | try: |
| 98 | # N.B.: We need to block on receiving the pid via fifo to prove that the PEX runtime has |
| 99 | # finished booting and completed any and all re-execs and landed in user code. |
| 100 | with open(pid_file) as fp: |
| 101 | assert process.pid == int(fp.read().strip()) |
| 102 | |
| 103 | exe, args = ( |
| 104 | subprocess.check_output( |
| 105 | args=["ps", "-p", str(process.pid), "-o", "command=", "-ww"] |
| 106 | ) |
| 107 | .decode("utf-8") |
| 108 | .strip() |
| 109 | .split(" ", 1) |
| 110 | ) |
| 111 | return exe, args |
| 112 | finally: |
| 113 | process.kill() |
| 114 | |
| 115 | def assert_expected_python(exe): |
| 116 | # type: (Text) -> None |
no test coverage detected