DRMacIver / shrinkray

Shrinkray is a modern multi-format test-case reducer
MIT License
86 stars 2 forks source link

fix logic error in interrupt_wait_and_kill #7

Closed cfbolz closed 1 month ago

cfbolz commented 1 month ago

fixes #6.

While writing the test I first missed the preexec_fn=os.setsid, and because interrupt_wait_and_kill uses signal_group, the test process got a SIGINT as well, stopping the test. This made me wonder about the assert in signal_group:

def signal_group(sp: "trio.Process", signal: int) -> None:
    gid = os.getpgid(sp.pid)
    assert gid != os.getgid()
    os.killpg(gid, signal)

os.getgid gives you the group id of the user running the process, not the process group id of the current procces, no? So maybe assert gid != os.getpgid(0) was what was meant? I'm happy to fix that too.

DRMacIver commented 1 month ago

Thanks for the fix!