A CLI tool to exit any process with arbitrary exit code
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pexit-0.1.0.tar.gz.
File metadata
- Download URL: pexit-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94b16c184d437f06db1ee6d5c4356e2f7b57b516f78c05e52dad636ea0ea2197
|
|
| MD5 |
c58331d4ab88b0c592753765bc749376
|
|
| BLAKE2b-256 |
7e0ac9c6c29880604518fa05583906ad83f95c3126415d13fb0bbaca3ba85200
|
File details
Details for the file pexit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pexit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
245a69fe3a0b8b62aef44d3fb4e8e75a48151ae2eeb44861bc4f8fe8453c6c00
|
|
| MD5 |
7e7c76fa789b1f27241d617dab1b2f5a
|
|
| BLAKE2b-256 |
61f563057e371869ff0f70a6d0a10c82ef75578633d74654cc8a35db694310b6
|