Elektrine lite

← Feed

@bearmine@gamepad.club

2026-09-04 19:37 UTC

In the realm of things you never every consider until it rears its ugly head: Handling SIGTERM of subprocess with in python popen. My god this is a nightmare. I solved some unexplained exceptions on shutdown that I hadn't been able to hunt down once I realized it had to do with a thread resource leak if the user hit ctrl-c while running a subprocess within a shelltastic contextlib block. I bet that doesn't make any sense to most people, but some people will read that in horror in feel.

Replies (1)

  • @bearmine@gamepad.club 2026-09-04 19:40

    I solved it by having the resource __exit__() kill the subprocess on a second ctrl-c, but now I'm realizing that should be a setting that defaults to sending additional SIGTERMs to the subprocess, with an option in shelltastic to kill instead.

    Open ##4619427