Skip to content

Conversation

@liammcinroy
Copy link

Adds a --sigterm flag (matching coverage.py's sigterm flag) to still write the coverage output if a SIGTERM signal is sent.

Helpful for using slipcover in e.g. docker containers.

Tested with a simple while True: ... script and then a kill -SIGTERM. I'm not too familiar with what sort of cleanup may be necessary for more complex cases, so I'd welcome any suggestions on how to truly gracefully exit.

Also, this currently ignores --fail-under, since it exits immediately instead. I'm happy to update it to e.g. raise an exception that is caught by a context manager surrounding the runpy / exec calls, so that the normal flow in __main__ afterwards is maintained. I chose not to for now, since the atexit isn't currently doing that either.

Thanks for creating/maintaining this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant