[llvm] Fix ExecuteAndWait with empty environment on Windows (PR #158719)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 05:03:09 PDT 2025


================
@@ -220,6 +220,10 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
       llvm::append_range(EnvBlock, EnvString);
       EnvBlock.push_back(0);
     }
+    // If an empty environment (*Env is size zero), we need to
+    // terminate with two nulls.
+    if ((*Env).size() == 0)
----------------
aganea wrote:

I would also change the comment above to something to this effect: « Empty environments need to be terminated with two nulls. », no need to repeat « *Env is size zero ».

https://github.com/llvm/llvm-project/pull/158719


More information about the llvm-commits mailing list