Private/Start-EdenLocalCommand.ps1
function Start-EdenLocalCommand { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Scope='Function')] [CmdletBinding()] param( [String] $EdenCommand, $Settings, [String] $LoggingPrefix ) Write-EdenInfo "Starting the Eden command job: $EdenCommand." $LoggingPrefix $location = Get-Location $scriptRoot = $PSScriptRoot $job = Start-Job -Name "cj-$EdenCommand" -ScriptBlock { $EdenCommand = $args[0] $Settings = $args[1] $LoggingPrefix = $args[2] $VerbosePref = $args[3] $ScriptRoot = $args[4] $Location = $args[5] try { Set-Location $Location Import-Module (Join-Path $ScriptRoot "../../Eden/Eden.psm1") . (Join-Path $ScriptRoot "./Invoke-EdenLocalCommand.ps1") $VerbosePreference = $VerbosePref Write-EdenInfo "Invoking the Eden command: $($EdenCommand)" $LoggingPrefix Invoke-EdenLocalCommand -EdenCommand $EdenCommand -Settings $Settings -LoggingPrefix $LoggingPrefix } catch { Write-EdenError "Failed to start the Eden command ($EdenCommand)" $LoggingPrefix throw $_ } $VerbosePreference = "Continue" } -ArgumentList @($EdenCommand, $Settings, $LoggingPrefix, $VerbosePreference, $scriptRoot, $location) # } -ArgumentList @($EdenCommand, $Settings) return $job } |