Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show stderr from code blocks #531

Closed
mgeisler opened this issue Mar 27, 2023 · 7 comments
Closed

Show stderr from code blocks #531

mgeisler opened this issue Mar 27, 2023 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mgeisler
Copy link
Collaborator

mgeisler commented Mar 27, 2023

Today, mdbook doesn't show stderr when running Rust code. The problem is that it uses a Playground endpoint which doesn't deliver this information. However, the Playground itself does have this information via an internal endpoint. See rust-lang/mdBook#1315 for details.

Fixing this would allow us to start using dbg!(foo) instead of println!("foo: {foo:?}") in our code samples and thus simplify a lot of code blocks.

With google/mdbook-i18n-helpers#75 merged, many more code blocks would be automatically removed from the translation files, thus reducing churn for our translators.

@mgeisler mgeisler added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Sep 15, 2023
@emmali01
Copy link
Collaborator

emmali01 commented Sep 23, 2023

I'll try to work on it in the next two weeks.
-- Emma

@mgeisler
Copy link
Collaborator Author

Thanks Emma! You might very likely have to make changes to the upstream mdbook — we should upstream as much as possible, both so it can benefit everybody and so we can avoid carrying patches (which makes it hard to update our version of mdbook).

@Alx-Lai
Copy link
Collaborator

Alx-Lai commented Oct 6, 2024

Hi @mgeisler, I applied rust-lang/mdBook#1315 in #2397. I think there's a room to discuss whether we should push it to upstream repo. My concern is that the original PR is put aside for a long time so we don't know if i'll be finally adopted or not; however, if we merge it first in downstream, the only possible effort comes iff it's finally adopted in upstream.

mgeisler pushed a commit that referenced this issue Nov 28, 2024
Add a stderr block.
Pros:
  - we can make use of dbg macro in our code Cons:
  - there's a limitation that the compile message also shows

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

Issue: #531

Signed-off-by: Alx-Lai <alexabc722@gmail.com>
@mgeisler mgeisler removed the help wanted Extra attention is needed label Nov 28, 2024
@mgeisler
Copy link
Collaborator Author

With #2397 merged, we can finally start using dbg! throughout the course! I suggest we close this as finished now and then create a new issue to focus on this conversion.

@mgeisler
Copy link
Collaborator Author

I created #2478 to track converting print statements to dbg!.

@mgeisler
Copy link
Collaborator Author

The change in #2397 did somehow not work when deployed — I don't know why, but I saw 500 Server Errors on every request. I reverted the change for now, but I hope we can fix it soon.

@mgeisler mgeisler reopened this Nov 28, 2024
@mgeisler
Copy link
Collaborator Author

This was added again #2503, so this is now fixed! Thanks a lot, @Alx-Lai!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants