Fixed: in some cases nib2cib would write to stdout, which wasn't captured by XcodeCapp.

Previously, only stderr was checked for response text. In some edge cases it would write an error message to stdout. In addition, the default error message provided when the return status was non-zero and the output was empty was implemented incorrectly.

Now all output from nib2cib is correctly captured.

Also updated help to indicate how to enable debug logging.
This commit is contained in:
Aparajita Fishman
2013-05-25 19:23:10 -04:00
parent 3159021d27
commit 668eb1f8c4
6 changed files with 211 additions and 20 deletions
+9 -2
View File
@@ -1188,7 +1188,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
@param launchPath The executable to launch
@param arguments NSArray containing the NSTask arguments
@param returnType Determines whether to return stdout, stderr, or nothing in the response
@param returnType Determines whether to return stdout, stderr, either, or nothing in the response
@return NSDictionary containing the return status (NSNumber) and the response (NSString)
*/
- (NSDictionary *)runTaskWithLaunchPath:(NSString *)launchPath arguments:(NSArray *)arguments returnType:(XCCTaskReturnType)returnType
@@ -1211,7 +1211,14 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
DDLogVerbose(@"Task exited: %@:%d", launchPath, task.terminationStatus);
NSData *data = [[(returnType == kTaskReturnTypeStdOut ? task.standardOutput : task.standardError) fileHandleForReading] availableData];
NSData *data = nil;
if (returnType == kTaskReturnTypeStdOut || returnType == kTaskReturnTypeAny)
data = [[task.standardOutput fileHandleForReading] availableData];
if (returnType == kTaskReturnTypeStdError || (returnType == kTaskReturnTypeAny && [data length] == 0))
data = [[task.standardError fileHandleForReading] availableData];
NSString *response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSNumber *status = [NSNumber numberWithInt:task.terminationStatus];