简体   繁体   中英

Make an app impossible to quit

I want to make an app I have impossible to quit by normal means, only by forcequitting. Is this possible? (I do have limited knowledge of bash)

I use MacOSX ElCapitan. Thank you in advance for the help!

Edit: To clarify, I want it not to be able to quit with + Q or by rightclicking the app and pressing quit, or quitting through the App menu on the top bar.

You could intercept any control-c type signals with a signal handler. Here is an example:

#!/bin/bash
trap "echo 'Caught Signal'" SIGHUP SIGINT SIGTERM
while true; do
    echo "looping"
    sleep 5
done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM