From 0119ba6b5216a979305d8845944fe3e3553fe85a Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@stfc.ac.uk>
Date: Sat, 8 Dec 2018 15:05:46 +0000
Subject: [PATCH] Fix check for grep.exe in Windows buildscript

---
 buildconfig/Jenkins/setupcompiler.bat | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/buildconfig/Jenkins/setupcompiler.bat b/buildconfig/Jenkins/setupcompiler.bat
index 435e1cd467a..6ac3a48fada 100755
--- a/buildconfig/Jenkins/setupcompiler.bat
+++ b/buildconfig/Jenkins/setupcompiler.bat
@@ -4,7 +4,9 @@
 ::
 :: On exit the CM_GENERATOR variable will be set appropriately.
 :: If the previous compiler does not match this then the
-:: CLEANBUILD flag is also set to yes
+:: CLEANBUILD flag is also set to yes. It assumes it will be called from
+:: a parent with "setlocal enableextensions enabledelayedexpansion" are set
+:: in the parent
 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 :: Find grep
@@ -59,3 +61,7 @@ if EXIST %_builddir%\CMakeCache.txt (
     echo Previous build used the same compiler. No need to clean.
   )
 )
+
+:: Make sure we exit cleanly at this point as we could pick up the error
+:: state from the "failed grep" in the CLEABUILD=yes case
+exit /b 0
-- 
GitLab