Index: /issm/trunk-jpl/jenkins/jenkins.sh
===================================================================
--- /issm/trunk-jpl/jenkins/jenkins.sh	(revision 24360)
+++ /issm/trunk-jpl/jenkins/jenkins.sh	(revision 24361)
@@ -538,4 +538,19 @@
 		juLog  -test=MATLAB-$i -name=Failure -error=FAILURE awk "/starting:$i/{flag=1;next}/finished/{flag=0} flag{print}" matlab_log.log
 	done
+
+	# Check that Python did not exit in error
+	matlabExitedInError=`grep -E "Error" matlab_log.log | wc -l`
+
+	if [ $matlabExitedInError -ne 0 ]
+	then
+		echo "----------MATLAB exited in error!----------"
+		cat matlab_log.log
+		echo "-----------End of matlab_log.log-----------"
+
+		# Clean up execution directory
+		rm -rf $ISSM_DIR/execution/*
+
+		exit 1
+	fi
 fi
 
