From db60f0614aebe2ae1eaa828384d989d0c27dcb25 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 12 Nov 2018 13:14:04 -0800 Subject: [PATCH] Revert "Ignoring backspace for empty lines on stdin/stdout mode (#8196)" (#8239) This reverts commit b525b1f0bde65f0c59ccd9bbfe25d1459fcff1a3. --- .../host/msh/ConsoleHostUserInterface.cs | 9 +-------- test/powershell/Host/ConsoleHost.Tests.ps1 | 12 ------------ 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index 09bf0dc9bd..62199895a7 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -1365,14 +1365,7 @@ namespace Microsoft.PowerShell } var c = unchecked((char)inC); - if (c == '\b' && !NoPrompt && sb.Length == 0) - { - continue; - } - if (!NoPrompt) - { - Console.Out.Write(c); - } + if (!NoPrompt) Console.Out.Write(c); if (c == '\r') { diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 3ad2b0a0e8..3b41812dec 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -476,18 +476,6 @@ foo $process.StandardOutput.ReadToEnd() | Should -Be "PS> " EnsureChildHasExited $process } - - It "Redirected input and sending backspace" { - # This test is for issue #8193, in which a backspace at the beginning of a command crashes powershell - $si = NewProcessStartInfo "-noprofile -nologo" -RedirectStdIn - $process = RunPowerShell $si - $process.StandardInput.Write("`$function:prompt = { 'PS> ' }`n") - $null = $process.StandardOutput.ReadLine() - $process.StandardInput.Write("`bexit`n") - $process.StandardOutput.ReadLine() | Should -Be "PS> exit" - $process.StandardInput.Close() - EnsureChildHasExited $process - } } Context "Exception handling" {