From 6e424d74fffc658b8e7dcf29a61ee8425f1de281 Mon Sep 17 00:00:00 2001
From: MOZGIII <mike-n@narod.ru>
Date: Thu, 18 Nov 2021 12:05:48 +0300
Subject: [PATCH] Set current dir at check_wasm_toolchain_installed at
 wasm-builder (#10284)

* Set current dir at check_wasm_toolchain_installed

* Add comments
---
 substrate/utils/wasm-builder/src/prerequisites.rs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/substrate/utils/wasm-builder/src/prerequisites.rs b/substrate/utils/wasm-builder/src/prerequisites.rs
index 7236b8169bc..88b1073a295 100644
--- a/substrate/utils/wasm-builder/src/prerequisites.rs
+++ b/substrate/utils/wasm-builder/src/prerequisites.rs
@@ -120,6 +120,9 @@ fn check_wasm_toolchain_installed(
 	let manifest_path = temp.path().join("Cargo.toml").display().to_string();
 
 	let mut build_cmd = cargo_command.command();
+	// Chdir to temp to avoid including project's .cargo/config.toml
+	// by accident - it can happen in some CI environments.
+	build_cmd.current_dir(&temp);
 	build_cmd.args(&[
 		"build",
 		"--target=wasm32-unknown-unknown",
@@ -132,6 +135,9 @@ fn check_wasm_toolchain_installed(
 	}
 
 	let mut run_cmd = cargo_command.command();
+	// Chdir to temp to avoid including project's .cargo/config.toml
+	// by accident - it can happen in some CI environments.
+	run_cmd.current_dir(&temp);
 	run_cmd.args(&["run", "--manifest-path", &manifest_path]);
 
 	// Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock
-- 
GitLab