Commits

Jason Harris committed 85cb07f

- Add hasErrors and hasWarnings methods to ExecutionResult.

  • Participants
  • Parent commits c45d55b

Comments (0)

Files changed (2)

Classes/General/TaskExecutions.h

 + (ExecutionResult*) extractResults:(NSTask*)task;
 + (ExecutionResult*) resultWithCmd:(NSString*)cmd args:(NSArray*)args result:(int)result outStr:(NSString*)outStr errStr:(NSString*)errStr;
 
+- (BOOL) hasErrors;
+- (BOOL) hasWarnings;
+
 @end
 
 

Classes/General/TaskExecutions.m

 #import "AppController.h"
 #import "Common.h"
 
-// This isn't really an error for us so go ahead and prune the missing extensions warnings.
-
 
 
 // -----------------------------------------------------------------------------------------------------------------------------------------
 // MARK: -
 
 @implementation ExecutionResult
+
 @synthesize generatingCmd = generatingCmd_;
 @synthesize generatingArgs = generatingArgs_;
 @synthesize result = result_;
 	return newResult;
 }
 
-- (void) pruneMissingExtensionsErrors
-{
-	if (IsEmpty(errStr_))
-		return;
-	NSString* regex = @"*** failed to import extension (.*?) from (.*?): (.*?)\n";
-	errStr_ = [errStr_ stringByReplacingOccurrencesOfRegex:regex withString:@""];
-	errStr_ = errStr_ ? errStr_ : @"";
-}
 
 + (ExecutionResult*) extractResults:(NSTask*)task
 {
 	return results;
 }
 
+// This isn't really an error for us so go ahead and prune the missing extensions warnings.
+- (void) pruneMissingExtensionsErrors
+{
+	if (IsEmpty(errStr_))
+		return;
+	NSString* regex = @"*** failed to import extension (.*?) from (.*?): (.*?)\n";
+	errStr_ = [errStr_ stringByReplacingOccurrencesOfRegex:regex withString:@""];
+	errStr_ = errStr_ ? errStr_ : @"";
+}
+
+- (BOOL) hasErrors		{ return result_ != 0 || [errStr_ isMatchedByRegex:@"^(?i)abort" options:RKLMultiline]; }
+- (BOOL) hasWarnings	{ return IsNotEmpty(errStr_) && ![self hasErrors]; }
 
 @end