Is there a way to listen to signals on Windows

妖精的绣舞 提交于 2019-12-10 18:27:58

问题


I'm writing a small shell for Windows in Rust, and want to kill the Command I spawned and prevent my shell from quitting.

Is there a way of capturing the Windows SIGINT equivalent in Rust?


回答1:


There is a crate, chan-signal, that aims to help in handling this, by spawning a thread and having it wait for signals.

EDIT: It doesn't currently support windows.

There is an RFC asking for this functionality to be integrated into the language's standard library, but it is very young.

It seems your option is to go with FFI.



来源:https://stackoverflow.com/questions/30956966/is-there-a-way-to-listen-to-signals-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!