Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func run(_ cmd: String) -> String? {
- let pipe = Pipe()
- let process = Process()
- process.launchPath = "/bin/sh"
- process.arguments = ["-c", String(format:"%@", cmd)]
- process.standardOutput = pipe
- let fileHandle = pipe.fileHandleForReading
- process.launch()
- return String(data: fileHandle.readDataToEndOfFile(), encoding: .utf8)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement