NSUserScriptTask: cancelling tasks?

2019-08-23 03:36发布

问题:

Is there any way to cancel a running NSUserScriptTask? The only way that comes to mind is to launch a separate process (a command line tool) via NSTask, whose only purpose is to run the NSUserScriptTask, and then terminate the command line tool via NSTask when necessary. However, that seems a bit far-fetched and not very optimized... Any ideas?