Python bindings to libgetargv, a library to correctly and quickly get other process's args
Project description
This module uses libgetargv to obtain binary string representations of the arguments of other processes on macOS.
Motivation
On macOS you must use the KERN_PROCARGS2 sysctl to obtain other proc's args, however the returned representation is badly documented and a naive approach doesn't deal with leading empty args. libgetargv parses the results of the sysctl correctly, and this module provides Python bindings to libgetargv.
Installation
Install the module with pip by executing:
$ pip install getargv
Usage
import os
import getargv
getargv.as_bytes(os.getpid()) #=> b'arg0\x00arg1\x00'
getargv.as_list(os.getpid()) #=> [b'arg0',b'arg1']
Development
After checking out the repo, run python setup.py build
. Then run python setup.py install
. Then, run python test.py
to run the tests. You can also run python -i load.py
for an interactive prompt that will allow you to experiment. Python code goes in the file src/getargv/__init__.py
, C code goes in the file src/getargv/getargvmodule.c
.
To install this module onto your local machine, run python setup.py build && python setup.py install
. To release a new version, update the version number in setup.py
, and then run RELEASE_COMMAND_HERE
, which will create a git tag for the version, push git commits and the created tag, and push the .module
file to pypi.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/getargv/getargv_python.
License
The module is available as open source under the terms of the BSD 3-clause License.
Project details
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
Hashes for getargv-0.1-cp39-cp39-macosx_13_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b69644ee5860445db56aa971f9e12d7d67efaa578f3831e512717ae50a4ec85 |
|
MD5 | 4a1b86bc5d01c203659df3defb85343f |
|
BLAKE2b-256 | 045697e29156eecece71c7eea0ec74ace1da187d819459326d813cefceecca8e |