-
Notifications
You must be signed in to change notification settings - Fork 889
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
thread 'main' panicked at 'failed to emit error: operation not supported by the terminal' #1180
Comments
Ideally, this would still format my rust code, skip whatever fancy colors or whatever are being attempted, and exit cleanly. |
This happens to me wherever I try to run rustfmt on windows.
|
Happens to me as well. $ rustc -V
rustc 1.15.0-nightly (28d6623bc 2016-12-03)
$ cargo -V
cargo 0.16.0-nightly (3568be9 2016-11-26)
$ RUST_BACKTRACE=1 cargo fmt
thread 'main' panicked at 'failed to emit error: operation not supported by the terminal', C:\Users\USER\.cargo\registry\src\github.com-1ecc6299db9ec823\syntex_errors-0.44.0\src\emitter.rs:724
stack backtrace:
0: 0x8580fe - <unknown>
1: 0x857906 - <unknown>
2: 0x8592ba - <unknown>
3: 0x859156 - <unknown>
4: 0x859079 - <unknown>
5: 0x76d042 - <unknown>
6: 0x777481 - <unknown>
7: 0x4c4ac0 - <unknown>
8: 0x40764e - <unknown>
9: 0x409319 - <unknown>
10: 0x858f38 - <unknown>
11: 0x863608 - <unknown>
12: 0x859a33 - <unknown>
13: 0x4013b4 - <unknown>
14: 0x4014e7 - <unknown>
15: 0x76e259bc - <unknown> |
I think I fixed the issue, at least on a windows computer with powershell. When syntex tries to print a message it formats the message with term. But setting term::attr::Bold returns a NotSupported error. |
@keringar Thank you for working on this issue! Unfortunately, it did not work in my environment (Arch Linux + eshell).
|
@topecongiro I updated my fork to check for all attributes before using them. Can you test it again? |
I could not build rustfmt with your fork. Could you fix it?
|
@topecongiro Sorry, please try again I pushed a fix. After the fix, I tested rustfmt on eshell, powershell and cmd and it doesn't panic. Might be fully fixed? |
@keringar Thank your for updates! Unfortunately rustfmt still panics on eshell + Arch Linux. Backtrace is basically identical, so omitting it here. |
@topecongiro Do you have a small example of the code I can test with? |
The issues I encountered in eshell are:
fn main() {
match x {
Some =>
}
} |
@topecongiro I fixed it in arch with eshell. I'm running it in a vm, but it should be the same. Please test it again. Now instead of panicking with |
@keringar I tested with your latest changes and they work fine. Thank you for you great work! |
Also, rustfmt panicking when a file does not exist can be prevented by explicitly checking the existence of the file in rustfmt rather than relegating it to syntex. I fell that nobody really cares, though I will create a PR shortly. |
I submitted a PR to serde-rs/Syntex. It's a minor patch so as soon as it's accepted and pushed into crates.io rustfmt should automatically start using the updated version for new builds. |
In emacs's
M-x shell
:The text was updated successfully, but these errors were encountered: