我可以将SIGINT发送到Windows上的Python子进程吗? [英] Can I send SIGINT to a Python subprocess on Windows?

查看:114
本文介绍了我可以将SIGINT发送到Windows上的Python子进程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Python脚本在Windows上管理gdb进程,并且我需要能够向生成的进程发送SIGINT才能停止目标进程(由gdb管理)

I've got a Python script managing a gdb process on Windows, and I need to be able to send a SIGINT to the spawned process in order to halt the target process (managed by gdb)

在Win32中似乎只有SIGTERM,但是很明显,如果我从控制台和Ctrl + C运行gdb,它会认为它正在接收SIGINT.有没有办法伪造此功能,使其在所有平台上都可用?

It appears that there is only SIGTERM available in Win32, but clearly if I run gdb from the console and Ctrl+C, it thinks it's receiving a SIGINT. Is there a way I can fake this such that the functionality is available on all platforms?

(我正在使用子流程模块和python 2.5/2.6)

(I am using the subprocess module, and python 2.5/2.6)

推荐答案

Windows没有unix信号IPC机制.

Windows doesn't have the unix signals IPC mechanism.

我希望将CTRL-C发送到gdb进程.

I would look at sending a CTRL-C to the gdb process.

这篇关于我可以将SIGINT发送到Windows上的Python子进程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆