Also cleanup local mpd if the pysawsim nosetests fail.
[sawsim.git] / misc / hooks / pre-commit-pysawsim-check
index 66a409dd42238ec912e5ccf2f9b79ff8a061520c..6e4f27b13965d8a89bfe81bbd5040e48dd1ced8f 100755 (executable)
@@ -7,18 +7,23 @@ if [ -n "$HAS_MPD" ]; then
     LOCAL_MPD=''
 
     mpdtrace >/dev/null 2>&1
-    if [ "$?" != 0 ]; then
+    if [ "$?" -ne 0 ]; then
        LOCAL_MPD='1'
        mpd &    # start an mpd instance
        sleep 1  # give mpd some time to start up
     fi           # otherwise there is an mpd instance already running
 
-    mpiexec -n 1 nosetests --with-doctest --doctest-tests pysawsim || exit 1
+    mpiexec -n 1 nosetests --with-doctest --doctest-tests pysawsim
+    RESULT="$?"
 
     if [ -n "$LOCAL_MPD" ]; then
        mpdallexit
     fi
 
+    if [ "$RESULT" -ne 0 ]; then
+       exit 1;
+    fi
+
 else  # no MPD
 
     nosetests --with-doctest --doctest-tests pysawsim || exit 1