8000 fix(backtrace): Fix backtrace logging and stdout by ThomasFrans · Pull Request #988 · hrkfdn/ncspot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(backtrace): Fix backtrace logging and stdout #988

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

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

ThomasFrans
Copy link
Contributor
  • Add manual implementation for panic that logs backtrace to a file.
  • Remove all manual output to stdout.
  • Fix new clippy warnings from Rust 1.65.

- Add manual implementation for panic that logs backtrace to a file.
- Remove all manual output to stdout.
- Fix new clippy warnings from Rust 1.65.
@ThomasFrans
Copy link
Contributor Author
ThomasFrans commented Nov 17, 2022

This is a small quality of life commit that tries to fix stdout. Since Cursive controls the tty, ncspot can't reliably print backtraces or other information to it. Therefore it's better to print that information to a file instead. I also removed the message that was displayed at startup, since it also showed some weird behavior (I think it tried to print with a <LF> on linux, but in raw mode, the terminal only moves down, and not to the beginning. After going back out of Raw mode, it doesn't find a valid <CR> and prints that '%' symbol.).

This is the backtrace that gets printed to the file:
image

It uses the native backtrace module that is new in Rust 1.65, so no external dependencies are required. The documentation says this is the same implementation that gets used internally, so it should be as accurate as the normal backtrace :)

@hrkfdn
Copy link
Owner
hrkfdn commented Nov 18, 2022

Thanks, this looks pretty cool. I have updated the docs and issue template to reflect these changes.
Previously one could redirect stderr output to a file to see the backtrace, but this is much nicer.

@hrkfdn hrkfdn merged commit e15657a into hrkfdn:main Nov 18, 2022
@ThomasFrans
Copy link
Contributor Author

I saw you added the RUST_BACKTACE=full in the user documentation. This isn't technically required anymore. That option is just there for when you need a backtrace on stderr, but since stderr isn't used for backtraces, you don't need that option. Internally, in the panic handler, it forces a backtrace to be written, even when the user hasn't enabled it explicitly :)

hrkfdn added a commit that referenced this pull request Nov 18, 2022
@hrkfdn
Copy link
Owner
hrkfdn commented Nov 18, 2022

Ah thanks! Fixed :)

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
0