<p dir="auto">Symfony\Component\Process<br>
I'm getting this error after running a process for a long time<br>
A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable<br>
Seems to be the windows workaround in getDescriptors()<br>
I found the problem to be 65,000 temp files created by this file in my windows temp but not removed. I have to clear these out daily.<br>
PHP should remove the files but they slowly build up.</p>
<p dir="auto">On Windows <code class="notranslate">Process::start</code> creates a temporary file every time because of this code:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        if (defined('PHP_WINDOWS_VERSION_BUILD')) {
            $this-&gt;fileHandles = array(
                self::STDOUT =&gt; tmpfile(),
            );"><pre class="notranslate">        <span class="pl-k">if</span> (defined(<span class="pl-s">'PHP_WINDOWS_VERSION_BUILD'</span>)) {
            <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">fileHandles</span> = <span class="pl-en">array</span>(
                <span class="pl-smi">self</span>::<span class="pl-c1">STDOUT</span> =&gt; tmpfile(),
            );</pre></div>
<p dir="auto">When being invoked for thousands of times as part of task scheduling pipeline, it leaves thousands of temporary files and eventually hits the limit at 65536 files per directory, after which point it can't create a new temporary file and simply dies.</p>
<p dir="auto">After being used, the temporary file should be deleted.</p>