Created
April 18, 2011 21:33
-
-
Save remear/926234 to your computer and use it in GitHub Desktop.
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
[progressIndicator startAnimation:nil]; | |
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ | |
NSTask *task = [[NSTask alloc] init]; | |
NSArray *arguments = [NSArray arrayWithObjects:@"-l", @"rvm", @"info", rubyName, @"ruby,homes,binaries,environment", nil]; | |
NSPipe *pipe = [NSPipe pipe]; | |
NSFileHandle *file = [pipe fileHandleForReading]; | |
[task setStandardOutput: pipe]; | |
[task setArguments: arguments]; | |
[task setLaunchPath:@"/bin/bash"]; | |
[task launch]; | |
[task waitUntilExit]; | |
NSData *data = [file readDataToEndOfFile]; | |
NSString *response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[infoBox setString:response]; | |
[progressIndicator stopAnimation:nil]; | |
[progressIndicator setHidden:YES]; | |
}); | |
[response release]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment