PowerShell handles Using keyword differently depending on PowerShell version and this change takes that into account.
This Using keyword support is only for variable sub expressions.
$using:var1
It does not support index sub expressions.
$using:array1[3]
I also updated ThreadJob class to derive from Job2 so that it can correctly handle terminating errors (Job class hides the terminating exception). This meant I had to implement a JobSourceAdapter to work with JobManager.
This PR adds support for the Using keyword withing script blocks or script files supplied to Start-ThreadJob.
PowerShell handles Using keyword differently depending on PowerShell version and this change takes that into account.
This Using keyword support is only for variable sub expressions.
It does not support index sub expressions.
I also updated ThreadJob class to derive from Job2 so that it can correctly handle terminating errors (Job class hides the terminating exception). This meant I had to implement a JobSourceAdapter to work with JobManager.