google / comprehensive-rust

This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
https://google.github.io/comprehensive-rust/
Apache License 2.0
27.98k stars 1.67k forks source link

Execution: Add stderr block #2397

Open Alx-Lai opened 1 month ago

Alx-Lai commented 1 month ago

Add a stderr block. Pros:

Applies patches from rust-lang/mdBook#1315 since the original change was not merged by rust-lang.

Issue: #531

mgeisler commented 1 month ago

Hi @Alx-Lai, oh wow, this patch looks great! Thanks a lot for looking into this, I would very much like to have this feature implemented.

I gave the PR a quick test run locally and this is how it looks:

https://github.com/user-attachments/assets/af54a9f2-b589-4666-b3c7-ee1ac6c5df9e

This is nearly perfect. A few comments:

I looked briefly at the full Playground and discovered that they use a WebSocket now to stream the output line by line! They include markers to show if this is a stdout or stderr:

image

I would be happy to merge this PR as a first step — I don't know how difficult it will be to adapt the mdbook code to use a WebSocket as well.

Alx-Lai commented 1 month ago

Ok, I'll spend time looking into it. Thanks for the feedback!

Alx-Lai commented 1 month ago

Updated the commit.

mgeisler commented 6 days ago

Hi @Alx-Lai, thanks for the update! I haven't forgotten about it, I'm just slow to review the change.

I'll try asking internally if someone else can help review this.

gotoextreme commented 5 days ago

I just tested the updated version, and it works great!

Screencast from 2024-11-20 16-12-30.webm