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