fix #529: exit with code 7 when error was logged
This commit is contained in:
		
							parent
							
								
									7274db714c
								
							
						
					
					
						commit
						4ba2155996
					
				@ -415,13 +415,23 @@ func (e *Executor) setupExitCode(ctx context.Context) {
 | 
				
			|||||||
	if ctx.Err() != nil {
 | 
						if ctx.Err() != nil {
 | 
				
			||||||
		e.exitCode = exitcodes.Timeout
 | 
							e.exitCode = exitcodes.Timeout
 | 
				
			||||||
		e.log.Errorf("Deadline exceeded: try increase it by passing --deadline option")
 | 
							e.log.Errorf("Deadline exceeded: try increase it by passing --deadline option")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if e.exitCode == exitcodes.Success &&
 | 
						if e.exitCode != exitcodes.Success {
 | 
				
			||||||
		(os.Getenv("GL_TEST_RUN") == "1" || os.Getenv("FAIL_ON_WARNINGS") == "1") &&
 | 
							return
 | 
				
			||||||
		len(e.reportData.Warnings) != 0 {
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						needFailOnWarnings := (os.Getenv("GL_TEST_RUN") == "1" || os.Getenv("FAIL_ON_WARNINGS") == "1")
 | 
				
			||||||
 | 
						if needFailOnWarnings && len(e.reportData.Warnings) != 0 {
 | 
				
			||||||
		e.exitCode = exitcodes.WarningInTest
 | 
							e.exitCode = exitcodes.WarningInTest
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if e.reportData.Error != "" {
 | 
				
			||||||
 | 
							// it's a case e.g. when typecheck linter couldn't parse and error and just logged it
 | 
				
			||||||
 | 
							e.exitCode = exitcodes.ErrorWasLogged
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@ const (
 | 
				
			|||||||
	Timeout              = 4
 | 
						Timeout              = 4
 | 
				
			||||||
	NoGoFiles            = 5
 | 
						NoGoFiles            = 5
 | 
				
			||||||
	NoConfigFileDetected = 6
 | 
						NoConfigFileDetected = 6
 | 
				
			||||||
 | 
						ErrorWasLogged       = 7
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ExitError struct {
 | 
					type ExitError struct {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user