feat: output force quit
This commit is contained in:
		
							parent
							
								
									5ac760814d
								
							
						
					
					
						commit
						573b94d896
					
				|  | @ -55,13 +55,13 @@ func (*Keyword) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 		return nil, true, err | 		return nil, true, err | ||||||
| 	} | 	} | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	end := false | 	forceQuit := false | ||||||
| 	for _, result := range results { | 	for _, result := range results { | ||||||
| 		tmp, matched := Parse(result, *conf) | 		tmp, matched := Parse(result, *conf) | ||||||
| 		if matched && conf.EndOnMatch { | 		if matched && conf.EndOnMatch { | ||||||
| 			end = true | 			forceQuit = true | ||||||
| 		} | 		} | ||||||
| 		res = append(res, tmp) | 		res = append(res, tmp) | ||||||
| 	} | 	} | ||||||
| 	return res, end, nil | 	return res, forceQuit, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -19,12 +19,12 @@ func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, true, err | 		return nil, true, err | ||||||
| 	} | 	} | ||||||
| 	end := false | 	forceQuit := false | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	for _, result := range results { | 	for _, result := range results { | ||||||
| 		comment := "" | 		comment := "" | ||||||
| 		if result.Status != stage.Status(envexec.StatusAccepted) { | 		if result.Status != stage.Status(envexec.StatusAccepted) { | ||||||
| 			end = true | 			forceQuit = true | ||||||
| 			comment = fmt.Sprintf( | 			comment = fmt.Sprintf( | ||||||
| 				"Unexpected executor status: %s.", result.Status, | 				"Unexpected executor status: %s.", result.Status, | ||||||
| 			) | 			) | ||||||
|  | @ -34,5 +34,5 @@ func (*ResultStatus) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 			Comment: comment, | 			Comment: comment, | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| 	return res, end, nil | 	return res, forceQuit, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -164,6 +164,7 @@ type ParserResult struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type StageResult struct { | type StageResult struct { | ||||||
| 	Name    string         `json:"name"` | 	Name      string         `json:"name"` | ||||||
| 	Results []ParserResult `json:"results"` | 	Results   []ParserResult `json:"results"` | ||||||
|  | 	ForceQuit bool           `json:"force_quit"` | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -26,17 +26,18 @@ func Run(stages []Stage) []StageResult { | ||||||
| 			slog.Error("parser not found", "name", stage.ParserName) | 			slog.Error("parser not found", "name", stage.ParserName) | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 		parserResults, end, err := parser.Run(executorResults, stage.ParserConf) | 		parserResults, forceQuit, err := parser.Run(executorResults, stage.ParserConf) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			slog.Error("parser run error", "name", stage.ExecutorName, "error", err) | 			slog.Error("parser run error", "name", stage.ExecutorName, "error", err) | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 		slog.Debug("parser run done", "results", parserResults) | 		slog.Debug("parser run done", "results", parserResults) | ||||||
| 		stageResults = append(stageResults, StageResult{ | 		stageResults = append(stageResults, StageResult{ | ||||||
| 			Name:    stage.Name, | 			Name:      stage.Name, | ||||||
| 			Results: parserResults, | 			Results:   parserResults, | ||||||
|  | 			ForceQuit: forceQuit, | ||||||
| 		}) | 		}) | ||||||
| 		if end { | 		if forceQuit { | ||||||
| 			break | 			break | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user