From e7ea2cb8c9dfaae4bebed74719852ed18c1e10d8 Mon Sep 17 00:00:00 2001 From: Russ Keldorph Date: Wed, 5 Dec 2018 15:58:32 -0800 Subject: [PATCH] Work around apparent bug in CMD's FOR /L Hopefully this will mean that official build failures during the actual build phase will correctly be reported as failures. There could be other places that need to change, but this is all we know of right now. Fixes dotnet/coreclr#18788 (at least part of it) Commit migrated from https://github.com/dotnet/coreclr/commit/1c8dd79c74e8021f5e2fb9c05116e69848470c87 --- src/coreclr/build-test.cmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/coreclr/build-test.cmd b/src/coreclr/build-test.cmd index 17ce589..a12fa09 100644 --- a/src/coreclr/build-test.cmd +++ b/src/coreclr/build-test.cmd @@ -343,7 +343,10 @@ for /l %%G in (1, 1, %__BuildLoopCount%) do ( echo %__BuildLog% echo %__BuildWrn% echo %__BuildErr% - exit /b 1 + REM This is necessary because of a(n apparent) bug in the FOR /L command. Under certain circumstances, + REM such as when this script is invoke with CMD /C "build-test.cmd", a non-zero exit directly from + REM within the loop body will not propagate to the caller. For some reason, goto works around it. + goto :Exit_Failure ) set __SkipPackageRestore=true @@ -633,3 +636,6 @@ ren "%CORE_ROOT%\temp.ni.dll" %2 echo Successfully precompiled %2 exit /b 0 + +:Exit_Failure +exit /b 1 -- 2.7.4