bb.process.run() is intended for bitbake's own use: it wraps subprocess
with logging behaviour and always decodes command output as UTF-8. The
latter makes _run() raise UnicodeDecodeError on files containing
non-UTF-8 bytes (e.g. Latin-1 author names in a changelog), which
_extract_changelog() hits when reading release notes with `git show`.
Call subprocess.run() directly and decode with errors='replace' to
tolerate that. Keep raising bb.process.ExecutionError so the existing
callers and their error messages are unaffected.
AI-Generated: Kiro with Claude Sonnet 5
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
import re
import shlex
import shutil
+import subprocess
import tempfile
import logging
import argparse
def _run(cmd, cwd=''):
logger.debug("Running command %s> %s" % (cwd,cmd))
- return bb.process.run('%s' % cmd, cwd=cwd)
+ result = subprocess.run(cmd, cwd=cwd or None, shell=True, capture_output=True,
+ text=True, errors='replace')
+ if result.returncode != 0:
+ raise bb.process.ExecutionError(cmd, result.returncode, result.stdout, result.stderr)
+ return (result.stdout, result.stderr)
def _get_srctree(tmpdir):
srctree = tmpdir