Skip to content

Commit

Permalink
Added 'like now' param handling (commented out)
Browse files Browse the repository at this point in the history
  • Loading branch information
MVKozlov committed May 17, 2017
1 parent 9195cb4 commit 6e5275d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PoshRSJob/Public/Start-RSJob.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,21 @@ Function Start-RSJob {
Write-Debug 'it is ForEach loop'
[void]$List.Add($ForeachValue)
}
# NewParam variant
if ($List.Count) {
$ArgumentCount++
}
# we add $_ into param() block when (ArgumentList+InputObject).Count > scriptBlock.Param().Count #or ForeachDetected
$InsertPSItemParam = ($ArgumentCount -gt $SBParamCount -and $List.Count) #-or $ForeachDetected

<# Current version behaviour variant
$ArgumentCount = $ArgumentList.Count
# Without 'Ignore' fix
$InsertPSItemParam = ($SBParamCount -ne 1 -or (($SBParamCount -ne $ArgumentCount) -xor $List.Count))
# With 'Ignore' fix
$InsertPSItemParam = (($SBParamCount -ne 1 -or $SBParamCount -eq $ArgumentCount) -and $List.Count)
#>

Write-Debug ("ArgumentCount: $ArgumentCount | List.Count: $($List.Count) | SBParamCount: $SBParamCount | InsertPSItemParam: $InsertPSItemParam")
#region Convert ScriptBlock for $Using:
$PreviousErrorAction = $ErrorActionPreference
Expand Down

0 comments on commit 6e5275d

Please sign in to comment.