#!/bin/bash

CMD="$*"

while [ true ]; do

   reset

   if [ -n "$RC" ]; then
      echo LAST RETURN CODE=$RC
   fi

   echo COMMAND=$CMD
   echo

   $CMD
   RC=$?

   echo RETURN CODE=$RC
   echo

   # 134 (double corruption, abort())
   # 139 (seg-fault)
   # 255 (exception, exit(-1))

   if [ $RC == 0 -o $RC == 255 ]; then
      exit
   fi

   while [ -e compiling ]; do
      sleep 1
   done

done

