aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-11-01 11:17:50 -0600
committerTom Rini <trini@konsulko.com>2023-11-02 22:38:01 -0400
commitae94c3d4ee21ba4dd628d2f463fb3992233963ef (patch)
tree7903a15c182f0e119e7e4abaa0f7d4a01c1001b9
parenta44cb1f2402a7f20f68e245bd37d6bdfe34e70f2 (diff)
downloadu-boot-ae94c3d4ee21ba4dd628d2f463fb3992233963ef.zip
u-boot-ae94c3d4ee21ba4dd628d2f463fb3992233963ef.tar.gz
u-boot-ae94c3d4ee21ba4dd628d2f463fb3992233963ef.tar.bz2
u_boot_pylib: Ensure subprocess is closed down
It isn't clear why we need to have two different paths for closing down the pipe. Unify them and use the Python to avoid this warning: subprocess.py:1127: ResourceWarning: subprocess 83531 is still running Note that this code appears to originally have come from [1] and was committed into the ChromeOS chromiumos/platform/crosutils repo in the bin/cros_image_to_target.py file. The addition of the extra code path came later, so that is chosen for the fixes tag. [1] https://codereview.chromium.org/3391008 Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: a10fd93cbc patman: Make command methods return a CommandResult
-rw-r--r--tools/u_boot_pylib/command.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/tools/u_boot_pylib/command.py b/tools/u_boot_pylib/command.py
index 9bbfc5b..bbe95d8 100644
--- a/tools/u_boot_pylib/command.py
+++ b/tools/u_boot_pylib/command.py
@@ -105,9 +105,7 @@ def run_pipe(pipe_list, infile=None, outfile=None,
last_pipe.communicate_filter(output_func))
if result.stdout and oneline:
result.output = result.stdout.rstrip(b'\r\n')
- result.return_code = last_pipe.wait()
- else:
- result.return_code = os.waitpid(last_pipe.pid, 0)[1]
+ result.return_code = last_pipe.wait()
if raise_on_error and result.return_code:
raise Exception("Error running '%s'" % user_pipestr)
return result.to_output(binary)