Skip to content

Commit c9e633c

Browse files
authored
swift_build_support: fix shell.run bytes printing (#68373)
* swift_build_support: fix `shell.run` bytes printing `output.splitlines()` returns a value of `bytes` type, not `str`, which leads to `b` prefixed to it when printing. This led to broken output when running `update-checkout`. Before: ``` [swiftpm] b"Already on 'main'" ``` After: ``` [swiftpm] Already on 'main' ``` * swift_build_support/shell.py: use `errors='replace'` in `decode`
1 parent 69d3933 commit c9e633c

File tree

1 file changed

+1
-1
lines changed
  • utils/swift_build_support/swift_build_support

1 file changed

+1
-1
lines changed

utils/swift_build_support/swift_build_support/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def run(*args, **kwargs):
242242
_echo_command(dry_run, *args, env=env, prompt="{0}+ ".format(prefix))
243243
if output:
244244
for line in output.splitlines():
245-
print("{0}{1}".format(prefix, line))
245+
print("{0}{1}".format(prefix, line.decode('utf-8', errors='replace')))
246246
sys.stdout.flush()
247247
sys.stderr.flush()
248248
if lock:

0 commit comments

Comments
 (0)