-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Steps to reproduce
function foo {
[cmdletbinding()]
Param([parameter(ValueFromPipeline)]$a)
Begin {1}
Process {2}
End {3}
}
Write-Host -ForegroundColor Green 'Expected:'
1..3|foo|%{$_} -pv x -ov y |select {$x},{$_},{$y}|out-host
Write-Host -ForegroundColor Green 'Actual:'
1..3|foo -pv x -ov y |select {$x},{$_},{$y}|out-host
Output:
Expected:
$x $_ $y
-- -- --
1 1 1
2 2 {1, 2}
2 2 {1, 2, 2}
2 2 {1, 2, 2, 2}
3 3 {1, 2, 2, 2…}
Actual:
$x $_ $y
-- -- --
1 1 1
2 {1, 2}
2 {1, 2, 2}
2 {1, 2, 2, 2}
3 {1, 2, 2, 2…}
Expected behavior
All output produced in any block (Begin, Process, or End) should be assigned to the PipelineVariable as it enters the pipeline. -OutVariable appears to behave correctly, i.e. it captures output that -PipelineVariable does not.
Actual behavior
Only output produced by the first block to exectute, and only on the first execution of that block is assigned to the PipelineVariable.
Examples:
- if a Begin block exists, the output from the Begin block will be assigned, but the output from the Process and End blocks will not.
- if a Begin block does not exists, the output from the first execution of the Process block will be assigned, but the output from subsequent executions of the Process block will not, and the output of the End block will not.
In the wild, on 5.1:
Environment data
Name Value
---- -----
PSVersion 7.0.0-preview.5
PSEdition Core
GitCommitId 7.0.0-preview.5
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
mklement0, ili101, AikenBM and thlac
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime