fix splitting up in wpfrunspace & catch errors

This commit is contained in:
MyDrift
2024-08-25 21:12:13 +02:00
parent cb6898d835
commit a4d1d0fd67
3 changed files with 7 additions and 10 deletions

View File

@ -22,13 +22,14 @@ function Invoke-WPFRunspace {
Param (
$ScriptBlock,
$ArgumentList,
$DebugPreference,
$automation
$DebugPreference
)
if ($automation = $true) {
if ($PARAM_RUN) {
write-host "Running in Main Thread"
& $ScriptBlock @ArgumentList @DebugPreference
} else {
write-host "Running in Runspace"
# Create a PowerShell instance
$script:powershell = [powershell]::Create()