i'm writing simple swift command line tool application automates of ios dev work. working except 1 thing - calling xcodebuild script.
my method looks this:
func runtest(devicename: string, os: string) { killallsimulators() let sdk = "iphonesimulator" let destination = "platform=ios simulator,name=" + devicename + ",os=" + os let arguments = ["-workspace", workspace, "-scheme", scheme, "-sdk", sdk, "-destination", destination, "test"] executor.executecommand("xcodebuild", arguments: arguments) } devicename equal "iphone 4s", os equal "9.0", workspace , scheme variables set.
my execute command has simple implementation:
func executecommand(command: string, arguments: [string]) -> nsstring? { _ = nsprocessinfo.processinfo().processidentifier let pipe = nspipe() let filehandle = pipe.filehandleforreading let task = nstask() task.launchpath = "/usr/bin/" + command task.arguments = arguments task.standardoutput = pipe task.launch() let data = filehandle.readdatatoendoffile() filehandle.closefile() return nsstring(data: data, encoding: nsutf8stringencoding) } i got error test failed because cdtool cannot compile. thats weird because same script called terminal works..
any ideas?
Comments
Post a Comment