codemod.parallel_exec_transform_with_prettyprint cannot be interrupted with SIGINT
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
When writing a codemod and using the `parallel_exec_transform_with_prettyprint` function, I've found that using Ctrl+C to send SIGNIT doesn't stop the process, but it instead interrupts the current thread attached to the terminal without a stack trace, and the remainder of the work proceeds in the background, cluttering the terminal until it's completed.
It seems that the `TransformExit` return code [is treated the same as a skip](https://github.com/Instagram/LibCST/blob/973895a6c0dd2347b250134694f53045c524101e/libcst/codemod/_cli.py#L656-L659). Perhaps instead `TransformExit` should be treated as a skip unless it is returned a certain number of times over a period of time?
An effective workaround is to use SIGQUIT (Ctrl+\\) in the terminal running the codemod, but it's a smidge inconvenient (causes macOS to think that python crashed unexpectedly) and users may not know it exists.
Contributor guide
Assessment
This issue has not been assessed yet.