Grab the failed target name if we can
[buildd-scripts.git] / bin / get_package
index 8a636a4..86d08b3 100755 (executable)
@@ -8,7 +8,12 @@ STATEDIR=/home/build/state
 cd in
 
 while true; do
-    FILE=$(ls -1 *.q | head -1)
+    FILE=$(ls -1 *.q 2>/dev/null| head -1)
+    if [ "$FILE"x = ""x ]; then
+       # If we didn't find a job
+       echo NOPACKAGE
+       exit 1
+    fi
     NUM=$(echo $FILE | cut -d. -f1)
     mv $NUM.q $NUM.proc
     if [ $? -ne 0 ]; then # we clashed