Skip to content

arvinpan/console_ctrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Console CTRL

This simple package allows you to send CTRL-C event to a target console process WITHOUT causing KeyboardInterrput at the caller side.

The solution is based on posts shared on stackoverflow (see Reference for details).

Usage

Install with pip install console-ctrl

In you code:

import console_ctrl
import subprocess

# Start some command IN A SEPARATE CONSOLE
p = subprocess.Popen(['some_command'], creationflags=subprocess.CREATE_NEW_CONSOLE)
# Do something else

console_ctrl.send_ctrl_c(p.pid)

Note: the target process should be started with creationflags=subprocess.CREATE_NEW_CONSOLE.

Reference

Specially thanks to people shared solutions here:

More official docs:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages