Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/PBEasyPipe.h b/PBEasyPipe.h
- index 8b15646..03b80b9 100644
- --- a/PBEasyPipe.h
- +++ b/PBEasyPipe.h
- @@ -12,6 +12,7 @@
- @interface PBEasyPipe : NSObject {
- }
- ++ (NSTask *) taskForCommand:(NSString *)cmd withArgs:(NSArray *)args inDir:(NSString *)dir;
- + (NSFileHandle*) handleForCommand: (NSString*) cmd withArgs: (NSArray*) args;
- + (NSFileHandle*) handleForCommand: (NSString*) cmd withArgs: (NSArray*) args inDir: (NSString*) dir;
- diff --git a/PBEasyPipe.m b/PBEasyPipe.m
- index 1fe7f37..45d1fc6 100644
- --- a/PBEasyPipe.m
- +++ b/PBEasyPipe.m
- @@ -106,7 +106,8 @@ + (NSString*) outputForCommand: (NSString*) cmd withArgs: (NSArray*) args inDir
- NSData* data = [handle readDataToEndOfFile];
- NSString* string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- -
- +
- + [task waitUntilExit];
- // Strip trailing newline
- if ([string hasSuffix:@"\n"])
- string = [string substringToIndex:[string length]-1];
- diff --git a/PBGitCommit.m b/PBGitCommit.m
- index 8e9a50d..30481f8 100644
- --- a/PBGitCommit.m
- +++ b/PBGitCommit.m
- @@ -40,8 +40,7 @@ - (NSString*) details
- if (details != nil)
- return details;
- - NSFileHandle* handle = [self.repository handleForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]];
- - details = [[NSString alloc] initWithData:[handle readDataToEndOfFile] encoding: NSUTF8StringEncoding];
- + details = [self.repository outputForArguments:[NSArray arrayWithObjects:@"show", @"--pretty=raw", self.sha, nil]];
- return details;
- }
- diff --git a/PBGitRevList.m b/PBGitRevList.m
- index 0f1a969..8bd1fcf 100644
- --- a/PBGitRevList.m
- +++ b/PBGitRevList.m
- @@ -88,7 +88,9 @@ - (void) walkRevisionListWithSpecifier: (PBGitRevSpecifier*) rev
- if ([rev hasPathLimiter])
- [arguments insertObject:@"--children" atIndex:1];
- - NSFileHandle* handle = [repository handleForArguments: arguments];
- + NSTask *task = [PBEasyPipe taskForCommand:[PBGitBinary path] withArgs:arguments inDir:nil];
- + [task launch];
- + NSFileHandle* handle = [task.standardOutput fileHandleForReading];
- int fd = [handle fileDescriptor];
- FILE* f = fdopen(fd, "r");
- @@ -153,6 +155,7 @@ - (void) walkRevisionListWithSpecifier: (PBGitRevSpecifier*) rev
- // Make sure the commits are stored before exiting.
- [self performSelectorOnMainThread:@selector(setCommits:) withObject:revisions waitUntilDone:YES];
- + [task waitUntilExit];
- }
- @end
Add Comment
Please, Sign In to add comment