Skip to content

fix: replace undecodable bytes in /system command output - #2450

Merged
rolandwalker merged 1 commit into
dbcli:mainfrom
pcbeingused333:fix/system-cmd-decode
Nov 19, 2026
Merged

rolandwalker merged 1 commit into
dbcli:mainfrom
pcbeingused333:fix/system-cmd-decode

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Prevents the crash when \! <cmd> / /system <cmd> prints output that is not valid in the locale encoding.

Root cause: execute_system_command decoded the subprocess output with response.decode(encoding) (strict). Any byte invalid in the locale encoding raised UnicodeDecodeError, and the REPL only displayed the codec's message instead of the command output.

Fix: decode with errors='replace', so undecodable bytes become U+FFFD and the rest of the output is shown. Changelog entry added.

Test: test_execute_system_command_undecodable_output feeds b'caf\xe9 ok' with a UTF-8 locale; it raised UnicodeDecodeError before and now returns 'caf� ok'.


This PR was prepared with the assistance of an AI coding agent (Claude); it has not been reviewed line by line by a human before submission.

Output of a subprocess run via /system or \! was decoded strictly with the locale encoding, so a non-decodable byte raised UnicodeDecodeError and the REPL only showed the codec message. Decode with errors='replace' instead.
@rolandwalker

Copy link
Copy Markdown
Contributor

Thank you!

@rolandwalker
rolandwalker merged commit a9d0984 into dbcli:main Nov 19, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants