-
-
Save owensd/c78eb9d5f2f0e933573d20b0ef8c0eb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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