【发布时间】:2018-12-09 19:11:57
【问题描述】:
我有这个代码:
func syncShellExec(path: String?) {
let script = [path!]
let process = Process()
let outputPipe = Pipe()
let filelHandler = outputPipe.fileHandleForReading
process.launchPath = "/bin/bash"
process.arguments = script
process.standardOutput = outputPipe
.
.
.
在 Swift 中我这样称呼它:
self.syncShellExec(path: Bundle.main.path(forResource: "initial", ofType: "command"))
现在我想为脚本本身添加一个额外的参数(使用 Bashscript 中的函数)。在终端中会是这样的:
/usr/bin/bash initial.command Do_My_Function
如何将此添加到流程中?
【问题讨论】: