mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #91566 from RainbowMango/pr_fix_invalid_recover_in_apiserver
Fix a wrong usage of recover in apiserver
This commit is contained in:
		@@ -63,7 +63,7 @@ type Reader struct {
 | 
			
		||||
	protocols        map[string]ReaderProtocolConfig
 | 
			
		||||
	selectedProtocol string
 | 
			
		||||
 | 
			
		||||
	handleCrash func() // overridable for testing
 | 
			
		||||
	handleCrash func(additionalHandlers ...func(interface{})) // overridable for testing
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewReader creates a WebSocket pipe that will copy the contents of r to a provided
 | 
			
		||||
@@ -78,7 +78,7 @@ func NewReader(r io.Reader, ping bool, protocols map[string]ReaderProtocolConfig
 | 
			
		||||
		err:         make(chan error),
 | 
			
		||||
		ping:        ping,
 | 
			
		||||
		protocols:   protocols,
 | 
			
		||||
		handleCrash: func() { runtime.HandleCrash() },
 | 
			
		||||
		handleCrash: runtime.HandleCrash,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -169,7 +169,7 @@ func TestStreamSurvivesPanic(t *testing.T) {
 | 
			
		||||
	r := NewReader(errs, false, NewDefaultReaderProtocols())
 | 
			
		||||
 | 
			
		||||
	// do not call runtime.HandleCrash() in handler. Otherwise, the tests are interrupted.
 | 
			
		||||
	r.handleCrash = func() { recover() }
 | 
			
		||||
	r.handleCrash = func(additionalHandlers ...func(interface{})) { recover() }
 | 
			
		||||
 | 
			
		||||
	data, err := readWebSocket(r, t, nil)
 | 
			
		||||
	if !reflect.DeepEqual(data, []byte(input)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user