mirror of https://github.com/scrapy/scrapy.git
Fix dangling file descriptor in FeedExporter when FEED_STORE_EMPTY is False (#4023)
This commit is contained in:
parent
5d75ed4cba
commit
1d5c270ce8
|
|
@ -242,7 +242,9 @@ class FeedExporter(object):
|
|||
def close_spider(self, spider):
|
||||
slot = self.slot
|
||||
if not slot.itemcount and not self.store_empty:
|
||||
return
|
||||
# We need to call slot.storage.store nonetheless to get the file
|
||||
# properly closed.
|
||||
return defer.maybeDeferred(slot.storage.store, slot.file)
|
||||
if self._exporting:
|
||||
slot.exporter.finish_exporting()
|
||||
self._exporting = False
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ class FeedExportTest(unittest.TestCase):
|
|||
content = f.read()
|
||||
|
||||
finally:
|
||||
shutil.rmtree(tmpdir, ignore_errors=True)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
defer.returnValue(content)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue