diff --git a/dropship/dropship.py b/dropship/dropship.py index 736b840..9740b8f 100644 --- a/dropship/dropship.py +++ b/dropship/dropship.py @@ -143,7 +143,7 @@ class DropShip: async def send(self, fpath): self._send_spinner_on() - code, scope = await self.nursery.start(wormhole_send, fpath) + code, scope = await self.nursery.start(wormhole_send, fpath, self) self._create_pending_transfer(fpath, code, scope) self.clipboard.set_text(code, -1) self._send_spinner_off(code) diff --git a/dropship/wormhole.py b/dropship/wormhole.py index f0018ea..732d866 100644 --- a/dropship/wormhole.py +++ b/dropship/wormhole.py @@ -5,7 +5,7 @@ from trio import TASK_STATUS_IGNORED, CancelScope, open_process, run_process from dropship import log -async def wormhole_send(fpath, task_status=TASK_STATUS_IGNORED): +async def wormhole_send(fpath, parent, task_status=TASK_STATUS_IGNORED): """Run `wormhole send` on a local file path.""" with CancelScope() as scope: command = ["wormhole", "send", fpath] @@ -21,6 +21,8 @@ async def wormhole_send(fpath, task_status=TASK_STATUS_IGNORED): process.terminate() log.info(f"wormhole_send: succesfully terminated process ({code})") + parent._remove_pending_transfer(code) + async def wormhole_recv(code, parent, task_status=TASK_STATUS_IGNORED): """Run `wormhole receive` on a pending transfer code."""