[SCM] morituri/master: * morituri/program/cdparanoia.py: Make sure exceptions don't prevent the task from chaining up to the parent stop() implementation, giving the runner a chance to actually stop.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:33 UTC 2014
The following commit has been merged in the master branch:
commit a8dddb9d70c0053c589e7236b45688ae05e2dddd
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Aug 7 17:57:24 2011 +0000
* morituri/program/cdparanoia.py:
Make sure exceptions don't prevent the task from chaining up
to the parent stop() implementation, giving the runner a chance
to actually stop.
diff --git a/ChangeLog b/ChangeLog
index 904d674..0a56e26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-07 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * morituri/program/cdparanoia.py:
+ Make sure exceptions don't prevent the task from chaining up
+ to the parent stop() implementation, giving the runner a chance
+ to actually stop.
+
2011-08-06 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/rip/debug.py:
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index 9fe90cb..c6f638a 100644
--- a/morituri/program/cdparanoia.py
+++ b/morituri/program/cdparanoia.py
@@ -447,33 +447,38 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
self.file_mode = 0666 - umask
def stop(self):
- if not self.exception:
- self.quality = max(self.tasks[0].quality, self.tasks[2].quality)
- self.peak = self.tasks[4].peak
- self.debug('peak: %r', self.peak)
-
- self.testchecksum = c1 = self.tasks[1].checksum
- self.copychecksum = c2 = self.tasks[3].checksum
- if c1 == c2:
- self.info('Checksums match, %08x' % c1)
- self.checksum = self.testchecksum
+ # FIXME: maybe this kind of try-wrapping to make sure
+ # we chain up should be handled by a parent class function ?
+ try:
+ if not self.exception:
+ self.quality = max(self.tasks[0].quality, self.tasks[2].quality)
+ self.peak = self.tasks[4].peak
+ self.debug('peak: %r', self.peak)
+
+ self.testchecksum = c1 = self.tasks[1].checksum
+ self.copychecksum = c2 = self.tasks[3].checksum
+ if c1 == c2:
+ self.info('Checksums match, %08x' % c1)
+ self.checksum = self.testchecksum
+ else:
+ # FIXME: detect this before encoding
+ self.error('read and verify failed')
+
+ if self.tasks[5].checksum != self.checksum:
+ self.error('Encoding failed, checksum does not match')
+
+ # delete the unencoded file
+ os.unlink(self._tmpwavpath)
+
+ os.chmod(self._tmppath, self.file_mode)
+
+ try:
+ shutil.move(self._tmppath, self.path)
+ except Exception, e:
+ self._exception = e
else:
- # FIXME: detect this before encoding
- self.error('read and verify failed')
-
- if self.tasks[5].checksum != self.checksum:
- self.error('Encoding failed, checksum does not match')
-
- # delete the unencoded file
- os.unlink(self._tmpwavpath)
-
- os.chmod(self._tmppath, self.file_mode)
-
- try:
- shutil.move(self._tmppath, self.path)
- except Exception, e:
- self._exception = e
- else:
- self.debug('stop: exception %r', self.exception)
+ self.debug('stop: exception %r', self.exception)
+ except Exception, e:
+ print 'WARNING: unhandled exception %r' % (e, )
task.MultiSeparateTask.stop(self)
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list