Browse Source

When send runs through, also remove

unifiedWindowUI 0.0.4
Luke Murphy 4 years ago
parent
commit
f210bad620
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 2
      dropship/dropship.py
  2. 4
      dropship/wormhole.py

2
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)

4
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."""

Loading…
Cancel
Save