scratchpads: don't fail if proc already removed

This commit is contained in:
fdev31 2023-04-30 22:25:56 +02:00
parent a7cc3cd4b8
commit 4a0cb5fb8f
2 changed files with 5 additions and 3 deletions

View file

@ -290,8 +290,10 @@ class Extension(Plugin):
if not item.isAlive():
print(f"{uid} is not running, restarting...")
self.procs[uid].kill()
del self.scratches_by_pid[self.procs[uid].pid]
del self.scratches_by_address[item.address]
if item.pid in self.scratches_by_pid:
del self.scratches_by_pid[item.pid]
if item.address in self.scratches_by_address:
del self.scratches_by_address[item.address]
self.start_scratch_command(uid)
while uid in self._respawned_scratches:
await asyncio.sleep(0.05)

View file

@ -47,7 +47,7 @@ class Extension(Plugin):
try:
idx = available_workspaces.index(cur_workspace)
except ValueError:
next_workspace = available_workspaces[0]
next_workspace = available_workspaces[0 if increment > 0 else -1]
else:
next_workspace = available_workspaces[
(idx + increment) % len(available_workspaces)