Cargo build crashing powershell and cmd


I have a clean install of Windows, and I mean CLEAN. I decided to format all my drives and install fresh. My setup is mostly the same as my old install on the same box, but with less cruft.

On running cargo build, everything will download fine, but somewhere in compiling the dependencies Powershell just… closes. I tried piping the outputs of a cargo build -v to a log file, but it doesn’t give any info, just normal outputs that suddenly stops. I’ve tried most obvious things: I’ve verified cl.exe is in my Path, I’ve tried running Powershell -NoProfile, I’ve tried it with -NoExit, and I’ve tried straight up running cargo in cmd instead of Powershell. I even tried the nightly toolchain, with the same error.

I’ve also tried setting the execution policy to Unrestricted instead of RemoteSigned, and still no dice. Restarted my computer, reinstalled rustup, etc, nothing helps.

The interesting thing is… cargo seems to actually be completing? Upon navigating back to the directory, no matter where Powershell/cmd crashed, the program is actually built. A simple cargo run will execute it with no compilation, so it seems like cargo keeps trucking on even after ps/cmd closes.

This will probably turn out to be more of a PS problem than a Rust problem, but cargo is the only thing I’ve noticed so far that triggers this behavior. And to make it even odder, this behavior doesn’t happen when running cargo build from the built-in terminal shelling out to powershell in VS Code. Does anyone have any ideas?

(E: Note: nothing shows up in the Windows event viewer)


I use powershell and cargo daily, and have never run into this :confused:

might be worth filing a cargo bug.


This is very weird. The only thing that comes to my mind is code page shenanigans.

What’s your console’s code page number? You can use chcp to see the active code page number.


The code page is 437.

Also, I want to be reasonably sure I’m not wasting the cargo team’s time before I file an issue.

E: I’ve also tried running cargo on another machine in PS over SSH, as well as doing a long scp just to make sure it’s not long-running processes in general messing with it somehow.


I have the same code page number and it works on my machine :confused:


I filed an issue since I nailed it down to something really specific. It could end up being a PS/cmd issue, but at least I have something tangible to point to now.