mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:37:24 -04:00 
			
		
		
		
	sigtrap: Ensure cleanup actions happen before too many things go wrong
This commit is contained in:
		
							parent
							
								
									f26447e2fb
								
							
						
					
					
						commit
						4b2e22289d
					
				| @ -41,14 +41,14 @@ func trapSignalsPosix() { | |||||||
| 			case syscall.SIGTERM: | 			case syscall.SIGTERM: | ||||||
| 				log.Println("[INFO] SIGTERM: Shutting down servers then terminating") | 				log.Println("[INFO] SIGTERM: Shutting down servers then terminating") | ||||||
| 				exitCode := executeShutdownCallbacks("SIGTERM") | 				exitCode := executeShutdownCallbacks("SIGTERM") | ||||||
|  | 				for _, f := range OnProcessExit { | ||||||
|  | 					f() // only perform important cleanup actions | ||||||
|  | 				} | ||||||
| 				err := Stop() | 				err := Stop() | ||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					log.Printf("[ERROR] SIGTERM stop: %v", err) | 					log.Printf("[ERROR] SIGTERM stop: %v", err) | ||||||
| 					exitCode = 3 | 					exitCode = 3 | ||||||
| 				} | 				} | ||||||
| 				for _, f := range OnProcessExit { |  | ||||||
| 					f() // only perform important cleanup actions |  | ||||||
| 				} |  | ||||||
| 				os.Exit(exitCode) | 				os.Exit(exitCode) | ||||||
| 
 | 
 | ||||||
| 			case syscall.SIGUSR1: | 			case syscall.SIGUSR1: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user