Skip to content

Instantly share code, notes, and snippets.

@drrost
Created December 11, 2019 12:14
Show Gist options
  • Save drrost/c9b52372bc89f743ada52ff9425975f3 to your computer and use it in GitHub Desktop.
Save drrost/c9b52372bc89f743ada52ff9425975f3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env swift
import Foundation
@discardableResult
func shell(_ args: String...) -> Int32 {
let task = Process()
task.launchPath = "/usr/bin/env"
task.arguments = args
task.launch()
task.waitUntilExit()
return task.terminationStatus
}
shell("ls")
shell("xcodebuild", "-workspace", "myApp.xcworkspace")
// taken here https://stackoverflow.com/questions/26971240/how-do-i-run-an-terminal-command-in-a-swift-script-e-g-xcodebuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment