Fix issue where invalid isolate commands would prevent other isolate commands from running

This commit is contained in:
2025-07-21 21:27:40 +02:00
parent 052c670627
commit bb69558aaa
4 changed files with 54 additions and 116 deletions

10
main.go
View File

@@ -354,7 +354,8 @@ func RunOtherCommands(file string, fileDataStr string, association utils.FileCom
cmdLogger.Info("Processing file %q with command %q", file, command.Regex)
newModifications, err := processor.ProcessRegex(fileDataStr, command, file)
if err != nil {
return fileDataStr, fmt.Errorf("failed to process file %q with command %q: %w", file, command.Regex, err)
logger.Error("Failed to process file %q with command %q: %v", file, command.Regex, err)
continue
}
modifications = append(modifications, newModifications...)
// It is not guranteed that all the commands will be executed...
@@ -370,7 +371,7 @@ func RunOtherCommands(file string, fileDataStr string, association utils.FileCom
}
if len(modifications) == 0 {
logger.Info("No modifications found for file %q", file)
logger.Warning("No modifications found for file %q", file)
return fileDataStr, nil
}
@@ -392,12 +393,13 @@ func RunIsolateCommands(association utils.FileCommandAssociation, file string, f
logger.Info("Processing file %q with isolate command %q", file, isolateCommand.Regex)
modifications, err := processor.ProcessRegex(fileDataStr, isolateCommand, file)
if err != nil {
return fileDataStr, fmt.Errorf("failed to process file %q with isolate command %q: %w", file, isolateCommand.Regex, err)
logger.Error("Failed to process file %q with isolate command %q: %v", file, isolateCommand.Regex, err)
continue
}
if len(modifications) == 0 {
logger.Warning("No modifications found for file %q", file)
return fileDataStr, nil
continue
}
var count int