Closed codykonior closed 6 years ago
In PoshRSJob.psm1 there's a "Routine to handle completed runspaces" and that's what seems to extract the error and add it to each job.
But I don't understand why it's dragging them out of other jobs and then appending them to later jobs.
It's because you check $CaughtErrors and never reset it. Modifying it to this fixes the problem:
$PoshRS_jobCleanup.PowerShell = [PowerShell]::Create().AddScript( {
#Routine to handle completed runspaces
#$PoshRS_jobCleanup.Host.UI.WriteVerboseLine("Begin Do Loop")
Do {
[System.Threading.Monitor]::Enter($PoshRS_Jobs.syncroot)
try {
Foreach ($job in $PoshRS_Jobs) {
$CaughtErrors = $false
I fixed a similar error for $Data
in #122, but did not look at the $errors :)
I'm not able to reproduce this anymore on the current build.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Results in
Basically one failed job pollutes the streams of all the others.
Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
PoshRSJob 1.7.3.11