[PATCH 1/8] fetch2: Allow runfetchcmd to handle lists of command arguments

Richard Purdie <[email protected]> Wed, 3 Jun 2026 11:48:33 +0100
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <[email protected]>
We want to be able to pass lists of arguments into process.run(), to
do this we need a way of avoding shell=True. Add such a codepath if
the cmd is a list (not a string).

Signed-off-by: Richard Purdie <[email protected]>
---
 lib/bb/fetch2/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 4234c62d0c8..e3b8f5787b1 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -979,7 +979,10 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None, extra
     error_message = ""
 
     try:
-        (output, errors) = bb.process.run(cmd, log=log, shell=True, stderr=subprocess.PIPE, cwd=workdir, env=env)
+        if isinstance(cmd, str):
+            (output, errors) = bb.process.run(cmd, log=log, shell=True, stderr=subprocess.PIPE, cwd=workdir, env=env)
+        else:
+            (output, errors) = bb.process.run(cmd, log=log, stderr=subprocess.PIPE, cwd=workdir, env=env)
         success = True
     except bb.process.NotFoundError as e:
         error_message = "Fetch command %s not found" % (e.command)