The persistent shell and background tasks read the subprocess's stdout in text
mode with strict decoding. One undecodable byte in a command's output (a binary
dump, a Latin-1 log line) raised UnicodeDecodeError inside the reader thread, the
thread died, and the command hung until its timeout with no output at all.
Decode with errors="replace" at both subprocess sites so the offending byte
becomes U+FFFD and the rest of the output is kept. Regression test covers the
foreground command and the background task.