Skip to content

Commit a80be13

Browse files
authored
fix(util/process): collect complete output from subprocess (#1036)
Run subprocess output one last time before exiting the combined output processing loop. Fix #1025 Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
1 parent fa31494 commit a80be13

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

craft_parts/utils/process.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def run(
151151

152152
with closing(BytesIO()) as combined_io:
153153
while True:
154+
finished = proc.poll() is not None
154155
try:
155156
# Time out if we don't have any event to handle
156157
for key, mask in selector.select(0.1):
@@ -164,7 +165,7 @@ def run(
164165
except BlockingIOError:
165166
pass
166167

167-
if proc.poll() is not None:
168+
if finished:
168169
combined = combined_io.getvalue()
169170
break
170171

docs/reference/changelog.rst

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changelog
33
*********
44

5+
2.4.3 (unreleased)
6+
------------------
7+
8+
Bug fixes:
9+
10+
- Address race condition when collecting subprocess output.
11+
512
2.4.2 (2025-03-04)
613
------------------
714

0 commit comments

Comments
 (0)