Refactor to eliminate global variable dependencies

Removes the use of global variables for paths and architecture settings. Instead, these values are now passed explicitly as parameters to the relevant functions.

This change improves code clarity, reduces the risk of side effects, and makes the functions more modular and easier to test.
This commit is contained in:
rbalsleyMSFT
2025-07-18 17:25:39 -07:00
parent c535126605
commit 9df663dc9b
4 changed files with 31 additions and 30 deletions
@@ -153,13 +153,6 @@ function Invoke-ParallelProcessing {
# Set the log path for this parallel thread
Set-CommonCoreLogPath -Path $localJobArgs['_currentLogFilePathForJob']
# Set other global variables if tasks rely on them (prefer passing as parameters)
$global:AppsPath = $localJobArgs['AppsPath']
$global:WindowsArch = $localJobArgs['WindowsArch']
if ($localJobArgs.ContainsKey('OrchestrationPath')) {
$global:OrchestrationPath = $localJobArgs['OrchestrationPath']
}
# Execute the appropriate background task based on $localTaskType
switch ($localTaskType) {
'WingetDownload' {