Use the same temp personal module path when env 'HOME' not defined by daxian-dbw · Pull Request #13239 · PowerShell/PowerShell

PR Summary

Fix #13189

When the env variable HOME is not defined, every Runspace startup on Unix platforms will try creating a folder in the form of /tmp/<new-guid>/.local/share/powershell/Modules as the personal user module path. That means LOTs of such folders get created when Foreach-Object -Parallel is dealing with a lot of inputs. In that situation, it may not be surprising to see strange failures like the DirectoryNotFoundException reported in the issue.

This PR adds a static field to cache the temporary personal user module path, so all Runspace's will use the same temp directory path in case HOME env variable is not defined.

PR Checklist