Preventing MSYS 'bash' from killing processes that trap ^C

前端 未结 6 1420
自闭症患者
自闭症患者 2021-02-01 14:56

I have a console-mode Windows application (ported from Unix) that was originally designed to do a clean exit when it received ^C (Unix SIGINT). A clean

6条回答
  •  长情又很酷
    2021-02-01 15:56

    When you run your program with MSYS bash, do you run the executable directly, or is there a wrapping (bash) shell script?

    If so, it may be registering a custom Ctrl-C handler with the trap command (that does a sleep followed by a kill.) If such a thing exists, alter or remove it.

    If there is no trap registered, or there is no wrapping script, consider making such a script and adding your own trap to override the default behavior. You can see an example of how to use it here or on bash's man page (in the SHELL BUILTINS section).

提交回复
热议问题