Index: ../trunk-jpl/jenkins/jenkins.sh
===================================================================
--- ../trunk-jpl/jenkins/jenkins.sh	(revision 18639)
+++ ../trunk-jpl/jenkins/jenkins.sh	(revision 18640)
@@ -191,17 +191,20 @@
 	exit
 EOF
 	cd $ISSM_DIR/test/NightlyRun
-	if [ "$OS" = "win7" ]; then
-		echo "HERE I AM"
-		matlab -nojvm -nosplash -r "exit;"
-		$MATLAB_PATH/bin/matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log
-	else
-		$MATLAB_PATH/bin/matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
-	fi
+	$MATLAB_PATH/bin/matlab -nojvm -nosplash -r "addpath $ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &
 done
 
 #wait until matlab closes
-if [ "$OS" != "win7" ]; then
+if [ "$OS" = "win7" ]; then
+	echo "Waiting for matlab on windows"
+	pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}')
+	while [ -n "$pid" ]
+	do
+		pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}')
+		sleep 1;
+	done
+	echo "DONE!"
+else
 	wait
 fi
 
