Skip to content

Instantly share code, notes, and snippets.

@owensd
Created May 24, 2017 23:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save owensd/c78eb9d5f2f0e933573d20b0ef8c0eb2 to your computer and use it in GitHub Desktop.
public func shell(tool toolPath: String, arguments: [String]) -> String {
let process = Process()
process.launchPath = toolPath
process.arguments = arguments
let output = Pipe()
process.standardOutput = output
process.launch()
process.waitUntilExit()
return String(
data: output.fileHandleForReading.readDataToEndOfFile(),
encoding: .utf8)!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment