From d97c34d622090b6274dc377e02efa8db4a502e7f Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Thu, 30 Oct 2008 12:06:51 -0700
Subject: [PATCH] debug/test_cli: fix error handling for catalog-shares, to
 make the test stop failing on windows

---
 src/allmydata/scripts/debug.py | 8 +++++---
 src/allmydata/test/test_cli.py | 1 -
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py
index 29e3e43f..39e5f97f 100644
--- a/src/allmydata/scripts/debug.py
+++ b/src/allmydata/scripts/debug.py
@@ -520,8 +520,11 @@ def call(c, *args, **kwargs):
     # take advantage of the fact that ImmediateReadBucketProxy returns
     # Deferreds that are already fired
     results = []
+    failures = []
     d = defer.maybeDeferred(c, *args, **kwargs)
-    d.addCallback(results.append)
+    d.addCallbacks(results.append, failures.append)
+    if failures:
+        failures[0].raiseException()
     return results[0]
 
 def describe_share(abs_sharefile, si_s, shnum_s, now, out):
@@ -580,7 +583,6 @@ def describe_share(abs_sharefile, si_s, shnum_s, now, out):
     elif struct.unpack(">L", prefix[:4]) == (1,):
         # immutable
 
-
         class ImmediateReadBucketProxy(ReadBucketProxy):
             def __init__(self, sf):
                 self.sf = sf
@@ -592,7 +594,7 @@ def describe_share(abs_sharefile, si_s, shnum_s, now, out):
         # use a ReadBucketProxy to parse the bucket and find the uri extension
         sf = storage.ShareFile(abs_sharefile)
         bp = ImmediateReadBucketProxy(sf)
-        bp.start()
+        call(bp.start)
 
         expiration_time = min( [lease.expiration_time
                                 for lease in sf.iter_leases()] )
diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py
index 6f72f250..204065e0 100644
--- a/src/allmydata/test/test_cli.py
+++ b/src/allmydata/test/test_cli.py
@@ -244,7 +244,6 @@ class CLI(unittest.TestCase):
         self.failUnlessEqual(out, "", out)
         self.failUnless("Error processing " in err, err)
         self.failUnless(nodedir1 in err, err)
-        self.flushLoggedErrors(AssertionError)
 
 
 class CLITestMixin:
-- 
2.45.2