The `console-ctrl` library provides a simple mechanism to send a CTRL-C event to a target console process on Windows without triggering a `KeyboardInterrupt` in the calling Python process. It is currently at version 0.1.0, with its sole release in February 2021, indicating a low and likely inactive release cadence.
pip install console-ctrlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to start a separate Python process in a new console and then use `console-ctrl.send_ctrl_c()` to send a CTRL-C event to it, causing the target process to handle the `KeyboardInterrupt` while the calling script continues uninterrupted. This example is Windows-specific.
Ensure the application using `console-ctrl` is deployed and run only on Windows. For cross-platform process control, consider alternatives like `os.kill` (Unix-like) or more robust process management libraries.
Use with caution on modern Python environments. Consider vendoring the code if long-term stability or specific Python versions are required, or explore alternative solutions for process control.
Ensure the target process has robust `try...except KeyboardInterrupt` blocks to gracefully handle the received signal and perform any necessary cleanup before exiting.
Install the package using pip: `pip install console-ctrl`
Ensure your application is running on a Windows operating system. For cross-platform process control, consider using `os.kill` for Unix-like systems.
When starting the target process using `subprocess.Popen`, ensure `creationflags=subprocess.CREATE_NEW_CONSOLE` is included. Pass the `pid` of this newly created process to `console_ctrl.send_ctrl_c`.
Correct the function name to `console_ctrl.send_ctrl_c`. Verify the exact spelling and casing against the library's documentation.
No dependency data recorded yet.