Skip to content

Commit

Permalink
transfer: Remove __del__.
Browse files Browse the repository at this point in the history
Fixes #1946.
  • Loading branch information
tomprince committed Jan 22, 2012
1 parent 5cfb8f5 commit 6919655
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion master/buildbot/steps/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def remote_close(self):
if self.mode is not None:
os.chmod(self.destfile, self.mode)

def __del__(self):
def cancel(self):
# unclean shutdown, the file is probably truncated, so delete it
# altogether rather than deliver a corrupted file
fp = getattr(self, "fp", None)
Expand Down Expand Up @@ -289,6 +289,10 @@ def start(self):

self.cmd = StatusRemoteCommand(self, 'uploadFile', args)
d = self.runCommand(self.cmd)
@d.addErrback
def cancel(res):
fileWriter.cancel()
return res
d.addCallback(self.finished).addErrback(self.failed)


Expand Down Expand Up @@ -358,6 +362,10 @@ def start(self):

self.cmd = StatusRemoteCommand(self, 'uploadDirectory', args)
d = self.runCommand(self.cmd)
@d.addErrback
def cancel(res):
dirWriter.cancel()
return res
d.addCallback(self.finished).addErrback(self.failed)

def finished(self, result):
Expand Down

0 comments on commit 6919655

Please sign in to comment.