Weird occasional problem when calling cargo from VSCode on macOS

I opened a project in VSCode as usual and then noticed that rust-analyzer was in a suspended state (yellow stop sign). I tried to execute cargo commands in the intergrated terminal and found that the program doesn't output anything or exit, and keyboard presses stay on the screen until ctrl-c is pressed. rustup show is stuck on getting the rustc version, and rustc --version does the same as cargo. However at the same time in the macOS terminal, there is no exception. Calling the original cargo binary in the toolchain folder directly in VSCode terminal behaves the same. I tried force quitting and restarting VSCode and the problem remained, then restarted the system and the problem disappeared. I'm just curious what could be the cause.

it seems a problem with the integrated terminal emulator of vscode. maybe try a different version, or try to tweak the settings of the integrated terminal. for example, on Windows, there's setting to use the conpty windows API, which can change the terminal behavior drastically, I don't know about mac, but I suppose there might be similar settings on macos.

"terminal.integrated.windowsEnableConpty": true

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.