Skip to main content

Terminates a subprocess gracefully, if it doesn't work, it will be killed (Windows only)

pip install gracefully_kill

Tested against Windows 10 / Python 3.10 / Anaconda

The function attempts to terminate the subprocess gracefully by closing its standard input, output, and error streams, waiting for a specified timeout, and finally terminating the process. This allows the subprocess to clean up its resources and exit properly. The function checks if the process is still alive after termination attempts. If it is, it uses the taskkill_force_pid_children function from the taskkill module to forcibly terminate any child processes associated with the given process ID. This ensures that the entire process hierarchy is terminated if necessary.

pro=subprocess.Popen('ping -t 8.8.8.8')
kill_process(pro, timeout=1)

Metadata

Release files for gracefully-kill 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gracefully-kill 0.10
File Size Uploaded Provenance Actions
gracefully_kill-0.10.tar.gz 3.4 kB Without provenance Details for gracefully_kill-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gracefully-kill 0.10
File Interpreter ABI Platform Actions
gracefully_kill-0.10-py3-none-any.whl Python 3 none any Details for gracefully_kill-0.10-py3-none-any.whl

Total release size: 8.3 kB

Release files / gracefully_kill-0.10.tar.gz

Download URL gracefully_kill-0.10.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3f9aae40ebea46b0ca703b51990a0a5b5a7b8d30225ccf3cac3c127e148ec09e
BLAKE2b-256 checksum
How to use checksums
3f743b71e16a164e442ce86e8f95c4eeb22b0d7573727851578d58b08df0d877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / gracefully_kill-0.10-py3-none-any.whl

Download URL gracefully_kill-0.10-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cde5bfc8ff6882374d208e63aeb79b05243f4108f0580dc8107d70b03c08a028
BLAKE2b-256 checksum
How to use checksums
3230564f25d7a6a1dd801c1e60308dfb5d5b34111d5ad7153748f70b3fe362f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for gracefully-kill 0.10

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.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page