Update powershell console exit codes to match Unix standards

This commit is contained in:
Steve Lee [MSFT] 2017-08-16 15:04:03 -07:00
parent d9c63b7218
commit 4c22b10a38
2 changed files with 6 additions and 8 deletions

View File

@ -53,10 +53,10 @@ namespace Microsoft.PowerShell
{ {
#region static methods #region static methods
internal const uint ExitCodeSuccess = 0x00000000; internal const int ExitCodeSuccess = 0;
internal const uint ExitCodeCtrlBreak = 0xFFFE0000; internal const int ExitCodeCtrlBreak = 128+21; // SIGBREAK
internal const uint ExitCodeInitFailure = 0xFFFF0000; internal const int ExitCodeInitFailure = 70; // Internal Software Error
internal const uint ExitCodeBadCommandLineParameter = 0xFFFD0000; internal const int ExitCodeBadCommandLineParameter = 64; // Command Line Usage Error
// NTRAID#Windows Out Of Band Releases-915506-2005/09/09 // NTRAID#Windows Out Of Band Releases-915506-2005/09/09
// Removed HandleUnexpectedExceptions infrastructure // Removed HandleUnexpectedExceptions infrastructure
@ -212,10 +212,7 @@ namespace Microsoft.PowerShell
{ {
s_theConsoleHost.ui.WriteErrorLine(ConsoleHostStrings.ConflictingServerModeParameters); s_theConsoleHost.ui.WriteErrorLine(ConsoleHostStrings.ConflictingServerModeParameters);
} }
unchecked return ExitCodeBadCommandLineParameter;
{
return (int)ExitCodeBadCommandLineParameter;
}
} }
// First check for and handle PowerShell running in a server mode. // First check for and handle PowerShell running in a server mode.

View File

@ -52,6 +52,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
BeforeAll { BeforeAll {
$powershell = Join-Path -Path $PsHome -ChildPath "powershell" $powershell = Join-Path -Path $PsHome -ChildPath "powershell"
$ExitCodeBadCommandLineParameter = 64
function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn) function NewProcessStartInfo([string]$CommandLine, [switch]$RedirectStdIn)
{ {