Executing task: cargo test -- --nocapture test1 < zsh:1: command not found: cargo
This is a bug of extension maybe...
Solution:
Firstly, you should known the version of your rust-lang extendsion. Use commands as below:
ls ~/.vscode/extensions/ | grep rust-lang
You can see some information like below:
rust-lang.rust-0.7.8
Okay, the verison is 0.7.8, then you need to edit it, adding source $HOME/.cargo/env;
:
vim ~/.vscode/extensions/rust-lang.rust-0.7.8/out/src/tasks.js
find cmdLine
variable in createShellExecution
function and modify it (maybe at line 25).
function createShellExecution(execution) {
const { binary, command, args, cwd, env } = execution;
// const cmdLine = `${command || binary} ${args.join(' ')}`;
const cmdLine = `source $HOME/.cargo/env; ${command || binary} ${args.join(' ')}`;
return new vscode_1.ShellExecution(cmdLine, { cwd, env });
}
Reload vscode.