rustfmt: thread 'main' panicked at 'failed to emit error: operation not supported by the terminal'
In emacs’s M-x shell:
$ RUST_BACKTRACE=1 cargo fmt
thread 'main' panicked at 'failed to emit error: operation not supported by the terminal', /Users/fitzgen/.cargo/registry/src/github.com-1ecc6299db9ec823/syntex_errors-0.43.0/src/emitter.rs:724
stack backtrace:
1: 0x10b5833ba - std::sys::backtrace::tracing::imp::write::h46f28e67d38b4637
2: 0x10b5856ef - std::panicking::default_hook::{{closure}}::h1d3243f546573ff4
3: 0x10b584bb5 - std::panicking::default_hook::h96c288d728df3ebf
4: 0x10b585166 - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
5: 0x10b585004 - std::panicking::begin_panic::hfbeda5aad583dc32
6: 0x10b584f22 - std::panicking::begin_panic_fmt::h4fe9fb9d5109c4bf
7: 0x10b4e9c99 - <syntex_errors::emitter::EmitterWriter as syntex_errors::emitter::Emitter>::emit::h59659432907ffdac
8: 0x10b4f3382 - syntex_errors::DiagnosticBuilder::emit::h69d5c96ffd49229d
9: 0x10b3d4b1d - rustfmt::format_input::h364b4d0ac3e55025
10: 0x10b3d8901 - rustfmt::run::h628aba487faebaab
11: 0x10b333150 - rustfmt::execute::h59d679989c4d799e
12: 0x10b334c96 - rustfmt::main::hfe15cf96550c7d30
13: 0x10b585caa - __rust_maybe_catch_panic
14: 0x10b5846f6 - std::rt::lang_start::haaae1186de9de8cb
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (7 by maintainers)
@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
failed to emit error, it panics on something else. I don’t know if that’s a bug though. Files with syntax errors on the other hand, error as expected.Ideally, this would still format my rust code, skip whatever fancy colors or whatever are being attempted, and exit cleanly.