We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f592f2d + 3a9f3c3 commit 4bac435Copy full SHA for 4bac435
conda_lock/invoke_conda.py
@@ -116,6 +116,11 @@ def _invoke_conda(
116
encoding="utf-8",
117
) as p:
118
stdout = []
119
+ # Using a thread so that both stdout and stderr can be consumed concurrently.
120
+ # This avoids a potential deadlock when the child conda process is trying to
121
+ # write to stderr (blocked, because the I/O is line-buffered) and conda-lock
122
+ # is still trying to read from stdout.
123
+ stdout_thread = None
124
if p.stdout:
125
126
def read_stdout() -> None:
@@ -131,7 +136,7 @@ def read_stdout() -> None:
131
136
for line in p.stderr:
132
137
stderr.append(line)
133
138
logging.error(line.rstrip())
134
- if p.stdout:
139
+ if stdout_thread:
135
140
stdout_thread.join()
141
142
if check_call and p.returncode != 0:
0 commit comments