我想运行一个git命令,然后从macOS应用程序启动Xcode。
但我现在在第一步就被阻止了:
运行git命令
Process
,
NSWorkspace.shared.openApplication
但我还是被挡住了。你可以在这里看到我最后一次尝试。
@discardableResult
func shell(_ app: String, _ args: String...) -> Int32 {
let task = Process()
task.launchPath = "/usr/bin/\(app)"
task.arguments = args
task.launch()
task.waitUntilExit()
return task.terminationStatus
}
shell("git", "clone https://github.com/user/repo.git")
git:'克隆
https://github.com/user/repo.git
'不是git命令。请参阅“git--help”。
我需要授予权限吗?