0

When I run cargo build it prints non-printable characters, which lock the terminal. I can workaround it, but I wonder why a tool would do that and how do I prevent it?

For example:

$ cargo build
   Compiling crypto-speed v0.1.0 (/home/dano/rust/speed)
error[E0277]: `std::time::Duration` doesn't implement `std::fmt::Display`
  퍊     ۽۰۰퍊     ۽۰      ۽۰                                              퍊     ۽۰۰퍊     ۽۰庺퍊     ۽۰  ۰퍊     ۽۰  ۽   ۽۰۰퍊     ۽   ۽۰   퍊     ۽ 宍
                                                                         ۰ 

I run SecureCRT, which is similar to PuTTY and other terminal programs. ls --color=always works, as does all the other color output. Just rustc is broken.

trent
  • 25,033
  • 7
  • 51
  • 90
Dan Anderson
  • 2,265
  • 1
  • 9
  • 20
  • 2
    Probably your terminal is shit. Which are you using? – LtWorf Mar 07 '19 at 18:29
  • 1
    I was using TERM=ansi through a ssh client, SecureCRT. I changed it to something simple (without color), TERM=vt100 and it works OK. – Dan Anderson Mar 07 '19 at 18:40
  • 1
    Terminal setting issues are (usually) nigh-impossible to reproduce and (usually) have little to do with the program you're running, but have something to do with your environment. What about `ls --color=always`? What terminal program are you running in (Konsole, xterm, PuTTY...)? – trent Mar 07 '19 at 19:52
  • 2
    My mistake, I didn't realize that your SSH client was also a terminal emulator. I would suggest asking on some forum or documentation specific to SecureCRT because it likely has something to do with the terminal emulation mode. – trent Mar 07 '19 at 21:56
  • I run SecureCRT, which is similar to PuTTY and other terminal programs. `ls --color=always` works, as does all the other color output. Just `rustc` is broken. Of course, maybe `rustc` uses something the other color output programs do not use. The workaround, for the benefit of others, is to pipe the stderr output to `cat -v` so `rustc` cannot corrupt the terminal. For example, `cargo build 2>&1 | cat -v` – Dan Anderson Mar 08 '19 at 18:27
  • Maybe TERM is set wrong… try setting it to xterm? – LtWorf Mar 08 '19 at 23:20

0 Answers0