I need to know when a command line program is stopped by the user to release some active bluetooth connections from a command-line program (running on the terminal), written in swift.
Say the user calls the program then exits by pressing ctrl+Z. How would I know ?
You can install a signal handler with Swift. For example:
Modified from this gist.