pexit
This is a CLI tool to exit any process with arbitrary exit code.
Instead of killing a process, do you ever want to "exit" it? pexit comes to the rescue!
With some prerequisites (see below), you can force any process to exit, even with your specified exit code!
Why would you want to use pexit?
- For fun.
- In the case of running a pipelined job
foo && bar, simply killingfoowill cause it to exit with error andbaris not executed. Usingpexit, however, can makefooexit with success so thatbarcontinues to be executed.
Install
pip install pexit
Usage
pexit <pid> [<exit_code>]
# The default value for <exit_code> is 0 (meaning success)
Limitations
pexitrelies on the system callptrace, which does not exit in some systems (like Windows).- To be able to
ptraceany process, you may need root privilege (sudo pexit ...) or allow this in system setting (sudo sysctl kernel.yama.ptrace_scope=0).
Acknowledgements
This project refers to the following sources:
- A great example showcasing how to use
ptraceto runprintf: https://github.com/eklitzke/ptrace-call-userspace/blob/master/call_fprintf.c
Metadata
Release files for pexit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pexit-0.1.0.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pexit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / pexit-0.1.0.tar.gz
| Download URL | pexit-0.1.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94b16c184d437f06db1ee6d5c4356e2f7b57b516f78c05e52dad636ea0ea2197
|
|
BLAKE2b-256 checksum How to use checksums |
7e0ac9c6c29880604518fa05583906ad83f95c3126415d13fb0bbaca3ba85200
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.7
|
Release files / pexit-0.1.0-py3-none-any.whl
| Download URL | pexit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
245a69fe3a0b8b62aef44d3fb4e8e75a48151ae2eeb44861bc4f8fe8453c6c00
|
|
BLAKE2b-256 checksum How to use checksums |
61f563057e371869ff0f70a6d0a10c82ef75578633d74654cc8a35db694310b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.7
|
Security for pexit 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.