如何调用shell脚本以从沙盒macOS应用程序管理LaunchAgent?

问题描述 投票:1回答:1

我有一个非沙盒式macOS应用程序,它使用以下方法愉快地调用其资源包中的Shell脚本:

class func runShell(launchPath: String, arguments: [String] = [], waitUntilExit: Bool) -> Void {
    let task = Process()
    task.launchPath = launchPath
    task.arguments = arguments

    let pipe = Pipe()
    task.standardOutput = pipe
    task.launch()

    if waitUntilExit {
        task.waitUntilExit()
    }
}
ABCProcessManager.runShell(launchPath: scriptPath.path, arguments: ["-workingdirectory", path], waitUntilExit: true)

我正在尝试将应用程序转换为沙盒应用程序(用于App Store上传),但是在调用脚本时会冻结。

这些脚本管理启动代理。加载,卸载,启动,停止。

我需要如何更改代码以使其在打开沙箱的情况下起作用?也许有一种管理启动代理的“沙盒方式”?

swift macos appstore-sandbox
1个回答
2
投票
我在Apple员工发布的Apple支持论坛上找到了答案:
© www.soinside.com 2019 - 2024. All rights reserved.