From da7fa3f771a69a75a49d9f18baa35457ec361a90 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 23 Aug 2022 10:47:01 -0700 Subject: [PATCH] Make `pwsh` server modes implicitly not show banner (#17921) --- .../host/msh/CommandLineParameterParser.cs | 4 ++++ test/xUnit/csharp/test_CommandLineParser.cs | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs index 0b54bcff24..a946051995 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -914,21 +914,25 @@ namespace Microsoft.PowerShell else if (MatchSwitch(switchKey, "socketservermode", "so")) { _socketServerMode = true; + _showBanner = false; ParametersUsed |= ParameterBitmap.SocketServerMode; } else if (MatchSwitch(switchKey, "servermode", "s")) { _serverMode = true; + _showBanner = false; ParametersUsed |= ParameterBitmap.ServerMode; } else if (MatchSwitch(switchKey, "namedpipeservermode", "nam")) { _namedPipeServerMode = true; + _showBanner = false; ParametersUsed |= ParameterBitmap.NamedPipeServerMode; } else if (MatchSwitch(switchKey, "sshservermode", "sshs")) { _sshServerMode = true; + _showBanner = false; ParametersUsed |= ParameterBitmap.SSHServerMode; } else if (MatchSwitch(switchKey, "noprofileloadtime", "noprofileloadtime")) diff --git a/test/xUnit/csharp/test_CommandLineParser.cs b/test/xUnit/csharp/test_CommandLineParser.cs index 70621dfdf0..966834fd2b 100644 --- a/test/xUnit/csharp/test_CommandLineParser.cs +++ b/test/xUnit/csharp/test_CommandLineParser.cs @@ -331,7 +331,7 @@ namespace PSTests.Parallel Assert.False(cpp.AbortStartup); Assert.True(cpp.NoExit); Assert.False(cpp.ShowShortHelp); - Assert.True(cpp.ShowBanner); + Assert.False(cpp.ShowBanner); Assert.True(cpp.SocketServerMode); Assert.Null(cpp.ErrorMessage); } @@ -348,7 +348,7 @@ namespace PSTests.Parallel Assert.False(cpp.AbortStartup); Assert.True(cpp.NoExit); Assert.False(cpp.ShowShortHelp); - Assert.True(cpp.ShowBanner); + Assert.False(cpp.ShowBanner); Assert.True(cpp.ServerMode); Assert.Null(cpp.ErrorMessage); } @@ -365,7 +365,7 @@ namespace PSTests.Parallel Assert.False(cpp.AbortStartup); Assert.True(cpp.NoExit); Assert.False(cpp.ShowShortHelp); - Assert.True(cpp.ShowBanner); + Assert.False(cpp.ShowBanner); Assert.True(cpp.NamedPipeServerMode); Assert.Null(cpp.ErrorMessage); } @@ -382,7 +382,7 @@ namespace PSTests.Parallel Assert.False(cpp.AbortStartup); Assert.True(cpp.NoExit); Assert.False(cpp.ShowShortHelp); - Assert.True(cpp.ShowBanner); + Assert.False(cpp.ShowBanner); Assert.True(cpp.SSHServerMode); Assert.Null(cpp.ErrorMessage); }