X Tutup
Skip to content

Pipeline Chain Operator not working consistently #10835

@SteveL-MSFT

Description

@SteveL-MSFT

It seems that after the first use of the pipeline chain operator, there is an issue where $? is cached so subsequent use exhibits different behavior.

If you run a successful get-item ., then it works correctly again.

Steps to reproduce

"hello" && get-item foo || "there"
"hello" || "there"

Expected behavior

S> "hello" && get-item foo || "there"
hello
Get-Item: Cannot find path '/Users/steve/repos/PowerShell/foo' because it does not exist.
there
[30.77ms] /Users/steve/repos/PowerShell [host-vt]
PS> "hello" || "there"
hello

Actual behavior

PS> "hello" && get-item foo || "there"
hello
Get-Item: Cannot find path '/Users/steve/repos/PowerShell/foo' because it does not exist.
there
[30.77ms] /Users/steve/repos/PowerShell [host-vt]
PS> "hello" || "there"
hello
there

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.4
PSEdition                      Core
GitCommitId                    7.0.0-preview.4-79-ge1203aa31b095cbffacb01978541fc641c07f770
OS                             Darwin 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup