agpl.py (filez): Slightly better detection of toplevels.
[chopwood] / agpl.py
diff --git a/agpl.py b/agpl.py
index 41ee376..caed713 100644 (file)
--- a/agpl.py
+++ b/agpl.py
@@ -142,13 +142,22 @@ def filez(cmd):
         if z < 0: break
         f = buf[i:z]
         i = z + 1
-        if f == '.': continue
+        if f.rstrip('/') == '.': continue
         if f.startswith('./'): f = f[2:]
         yield f
 
       ## Whatever's left over will be dealt with next time through.
       left = buf[i:]
 
+    ## Make sure the command actually completed successfully.
+    if kid.wait():
+      rc = kid.returncode
+      raise U.ExpectedError, \
+          (500, "lister command `%s' failed (%s) in `%s'" % (
+            cmd,
+            (rc & 0xff00) and 'rc = %d' % (rc >> 8) or 'signal %d' % rc,
+            dir))
+
     ## If there's trailing junk left over then we should complain.
     if left:
       raise U.ExpectedError, \