最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

swift - How can I kill a long running process when my MacOS app is terminated? - Stack Overflow

programmeradmin2浏览0评论

Within my Mac application, I start a long running process (a local server) as so:

let process = Process()
process.launchPath = "/bin/zsh"
process.arguments = ["-c"] + ["'\(command)'"]
try process.run()

I've noticed that when my app is terminated, the process is not and it keeps running.

How can I make it so that the process is killed when my app is terminated (regardless of how it is terminated, i.e. force quit, kill -9, crash, etc.)?

发布评论

评论列表(0)

  1. 暂无评论