Skip to content

Commit e484eaa

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 e484eaa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

s3torchconnectorclient/python/tst/integration/test_logging.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# // SPDX-License-Identifier: BSD
33
import os.path
4+
import platform
45
import sys
56
import tempfile
67
from typing import List
@@ -180,7 +181,7 @@ def _start_subprocess(
180181
debug_logs_config: str = "",
181182
logs_directory: str = "",
182183
):
183-
process = subprocess.Popen(
184+
result = subprocess.run(
184185
[
185186
sys.executable,
186187
"-c",
@@ -190,11 +191,10 @@ def _start_subprocess(
190191
debug_logs_config,
191192
logs_directory,
192193
],
193-
stdout=subprocess.PIPE,
194-
stderr=subprocess.PIPE,
194+
capture_output=True,
195195
text=True,
196196
)
197-
return process.communicate()
197+
return result.stdout, result.stderr
198198

199199

200200
def _read_log_file(log_file: str):

0 commit comments

Comments
 (0)