See T13224. A user reports the setTimeout() not actually killing Pygments under Ubuntu, where the default shell is "dash".
I think what's happening here is:
- Dash creates a strict subprocess always, Bash only does sometimes. If you "bash" a single simple command, it automatically behaves like you "exec"'d it and replaces itself.
- So we end up with "dash" as our subprocess, and then "pygments" under it.
- setTimeout() does SIGTERM + wait + SIGKILL.
- When we SIGTERM, I'd guess it propagates to "pygments" but "pygments" ignores it (it's stuck inside regexp explosion land).
- When we SIGKILL, I think it kills "dash" and leaves "pygments" alive.
I didn't really test any of this since it's theoretically sound and adding "exec" is generally safe, and the reporting user says it fixed things.