Created
November 15, 2016 12:53
-
-
Save codelynx/523826cfff0e4e8fc4b105a3697a36d7 to your computer and use it in GitHub Desktop.
Code snippet to execute command line with arguments [Mac] [Swift]
This file contains hidden or 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
| let process = Process() | |
| process.launchPath = "/usr/sbin/arp" | |
| process.arguments = ["-a"] | |
| let pipe = Pipe() | |
| process.standardOutput = pipe | |
| process.launch() | |
| let output = pipe.fileHandleForReading.readDataToEndOfFile() | |
| let outputString = String(bytes: output, encoding: .utf8)! | |
| print(outputString) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment