|
33 | 33 | from pathlib import Path |
34 | 34 | from subprocess import CompletedProcess, Popen, TimeoutExpired |
35 | 35 | from tempfile import TemporaryDirectory |
36 | | -from threading import Event, Thread |
| 36 | +from threading import Event |
37 | 37 | from types import FrameType |
38 | 38 | from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union |
39 | 39 |
|
@@ -93,7 +93,6 @@ def start_process( |
93 | 93 | cmd: Union[str, List[str]], |
94 | 94 | via_staticx: bool = False, |
95 | 95 | tmpdir: Optional[Path] = None, |
96 | | - direct_call: bool = True, |
97 | 96 | **kwargs: Any, |
98 | 97 | ) -> Popen: |
99 | 98 | if isinstance(cmd, str): |
@@ -137,15 +136,6 @@ def start_process( |
137 | 136 | **kwargs, |
138 | 137 | ) |
139 | 138 |
|
140 | | - def process_exit_handler() -> None: |
141 | | - process.communicate() |
142 | | - # Remove from _processes and do any cleanup |
143 | | - cleanup_process_reference(process) |
144 | | - logger.critical(f"Process {process.pid} exited, total processes tracked {len(_processes)}") |
145 | | - |
146 | | - _processes.append(process) |
147 | | - if direct_call: |
148 | | - Thread(target=process_exit_handler, daemon=True).start() |
149 | 139 | return process |
150 | 140 |
|
151 | 141 |
|
@@ -230,7 +220,7 @@ def run_process( |
230 | 220 | stderr: bytes |
231 | 221 |
|
232 | 222 | reraise_exc: Optional[BaseException] = None |
233 | | - with start_process(cmd, via_staticx, direct_call=False, **kwargs) as process: |
| 223 | + with start_process(cmd, via_staticx, **kwargs) as process: |
234 | 224 | assert isinstance(process.args, str) or ( |
235 | 225 | isinstance(process.args, list) and all(isinstance(s, str) for s in process.args) |
236 | 226 | ), process.args # mypy |
|
0 commit comments