From a3f699564ca1b786af238a81a2b6388bf6d3d844 Mon Sep 17 00:00:00 2001 From: Dmitry Savintsev Date: Sun, 29 Jan 2023 07:20:18 +0100 Subject: [PATCH] change to 'rustup run nightly cargo' On Windows, running the cargo command doesn't "see" the rust-toolchain.toml file despite `current_dir(dir)`. Using `rustup run nightly cargo` does work. --- xtask/src/build_ebpf.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xtask/src/build_ebpf.rs b/xtask/src/build_ebpf.rs index 452cb17..f646ed3 100644 --- a/xtask/src/build_ebpf.rs +++ b/xtask/src/build_ebpf.rs @@ -43,6 +43,9 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("{{project-name}}-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ + "run", + "nightly", + "cargo", "build", "--verbose", target.as_str(), @@ -57,7 +60,7 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { // vars set by the cargo xtask command are also inherited. RUSTUP_TOOLCHAIN is removed // so the rust-toolchain.toml file in the -ebpf folder is honored. - let status = Command::new("cargo") + let status = Command::new("rustup") .current_dir(dir) .env_remove("RUSTUP_TOOLCHAIN") .args(&args)