Skip to content

Commit 0e94c22

Browse files
committed
fix(test): mitigate subprocess fork race conditions in logging test
Use subprocess.run() instead of Popen() to mitigate race conditions in s3client fork handlers. A stronger fix might be needed if this still causes race conditions, as run() still uses fork multiprocessing.
1 parent ff21763 commit 0e94c22

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

s3torchconnectorclient/python/tst/integration/test_logging.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _start_subprocess(
180180
debug_logs_config: str = "",
181181
logs_directory: str = "",
182182
):
183-
process = subprocess.Popen(
183+
result = subprocess.run(
184184
[
185185
sys.executable,
186186
"-c",
@@ -190,11 +190,10 @@ def _start_subprocess(
190190
debug_logs_config,
191191
logs_directory,
192192
],
193-
stdout=subprocess.PIPE,
194-
stderr=subprocess.PIPE,
193+
capture_output=True,
195194
text=True,
196195
)
197-
return process.communicate()
196+
return result.stdout, result.stderr
198197

199198

200199
def _read_log_file(log_file: str):

0 commit comments

Comments
 (0)