fn spawn_publisher_loop(
args: &Args,
mps: Option<WpsClient>,
buffered: Arc<Mutex<Vec<u8>>>,
rx: Receiver<LineEvent>,
) -> JoinHandle<()> ⓘExpand description
Shared publisher loop — drains the LineEvent channel, aggregates into the model-visible buffer, and publishes each line via MPS.
Leading-\r spinner handling: throttled spinner frames (npm, cargo,
ora, tqdm at >50 ms/frame) are collapsed upstream — in the
pending_cr_override slot inside stream_reader (pipe path) and
pty_reader_loop (PTY path) — before reaching this loop. The
pending_cr_line slot here remains as a secondary layer: when a frame
arrives with a leading \r, the prior stored frame is published first
(so no frame is silently dropped), then the new frame is stored and
flushed at the next non-\r line or EOF. Consecutive spinner frames
therefore appear as sequential published chunks in the live log.
The model-visible buffer (buffered) receives the post-collapse LineEvent
bytes. Intermediate spinner frames collapsed by pending_cr_override never
become LineEvents and are not present in buffered; the model sees only the
surviving final frame for each overwrite sequence.