From 16c6030f06f10a0bda3277b505981ffab3a589cf Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Thu, 4 May 2023 15:00:18 -0400 Subject: [PATCH] Fix the check when reading input in `NativeCommandProcessor` (#19614) --- .../engine/NativeCommandProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index 3bb0fef21b..2168365c74 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -435,8 +435,8 @@ namespace System.Management.Automation { // If upstream is a native command it'll be writing directly to our stdin stream // so we can skip reading here. - if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) - && !UpstreamIsNativeCommand) + if (!ExperimentalFeature.IsEnabled(ExperimentalFeature.PSNativeCommandPreserveBytePipe) + || !UpstreamIsNativeCommand) { while (Read()) {