Fix: if errorlevel 0 is almost always true (dotnet/coreclr#5308)
authorJames Ko <jamesqko@gmail.com>
Mon, 30 May 2016 17:36:10 +0000 (13:36 -0400)
committerJan Kotas <jkotas@microsoft.com>
Mon, 30 May 2016 17:36:10 +0000 (10:36 -0700)
Explanation: if errorlevel n actually tests if the errorlevel is
greater than or equal to n. See: http://ss64.com/nt/if.html

Commit migrated from https://github.com/dotnet/coreclr/commit/99311238763b43488006f473cf2892b574287579

src/coreclr/build.cmd

index a5e6109..04cef48 100644 (file)
@@ -456,7 +456,7 @@ echo %__MsgPrefix%Generating native image of System.Private.CoreLib for %__Build
 set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
 set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe"
 "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1
-if NOT errorlevel 0 (
+if %errorlevel% NEQ 0 (
     echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to the build log file for details:
     echo     %__CrossGenCoreLibLog%
     exit /b 1
@@ -467,7 +467,7 @@ echo %__MsgPrefix%Generating native image of MScorlib facade for %__BuildOS%.%__
 set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenMSCoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
 set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe"
 "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\mscorlib.ni.dll" "%__BinDir%\mscorlib.dll" > "%__CrossGenCoreLibLog%" 2>&1
-if NOT errorlevel 0 (
+if %errorlevel% NEQ 0 (
     echo %__MsgPrefix%Error: CrossGen mscorlib facade build failed. Refer to the build log file for details:
     echo     %__CrossGenCoreLibLog%
     exit /b 1