Which Windows env var is responsible for DNS resolition?

⚓ Rust    📅 2026-04-17    👤 surdeus    👁️ 2      

surdeus

Although, it isn't a pure Rust question, I simply do not know where to ask it. I asked from several AI engines with no success. Here is my code snippet:

let output = Command::new("git")
                                .arg("clone")
                                .arg("-o")
                                .arg(rep_name)
                                .arg(git_url)
                                .current_dir(real_dir.parent().ok_or("no parent directory")?)
                                .env(
                                    "HOME",
                                    config
                                        .to_real_path("", None)
                                        .ok_or("project path misconfiguration")?,
                                )
                                .output()?;
                            if output.status.success().not() {
                                ok = format!("Err:  {}", output.status)
                            }
                        
                            let stderr_str = String::from_utf8_lossy(&output.stderr);
                            if !stderr_str.trim().is_empty() && !stderr_str.starts_with("Cloning into") {
                                eprintln!("clonning err: {stderr_str}");
                                ok = format!("Err:  {stderr_str}");
                            }

It works flawlessly in Linux environment, however fails on Windows with a message: can't resolve github.com. I clear environment before the call, and for the reason I restore 'HOME' in Linux. If I pass a complete environment on Windows, the Rust code works as well. However, I do not want to do that for a security reason. I need only to locate one (maybe few more) env variable critical for DNS resolution on Windows?

1 post - 1 participant

Read full topic

🏷️ Rust_feed