Merge pull request #2187 from crosbymichael/sigpipe
Handle SIGPIPE in shims
This commit is contained in:
		@@ -208,6 +208,7 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal, server *ttrpc.S
 | 
			
		||||
					sv.Delete(context.Background(), &ptypes.Empty{})
 | 
			
		||||
					close(done)
 | 
			
		||||
				})
 | 
			
		||||
			case unix.SIGPIPE:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,19 +19,19 @@ package main
 | 
			
		||||
import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"os/signal"
 | 
			
		||||
	"syscall"
 | 
			
		||||
 | 
			
		||||
	"github.com/containerd/containerd/reaper"
 | 
			
		||||
	runc "github.com/containerd/go-runc"
 | 
			
		||||
	"github.com/opencontainers/runc/libcontainer/system"
 | 
			
		||||
	"github.com/stevvooe/ttrpc"
 | 
			
		||||
	"golang.org/x/sys/unix"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// setupSignals creates a new signal handler for all signals and sets the shim as a
 | 
			
		||||
// sub-reaper so that the container processes are reparented
 | 
			
		||||
func setupSignals() (chan os.Signal, error) {
 | 
			
		||||
	signals := make(chan os.Signal, 32)
 | 
			
		||||
	signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT, syscall.SIGCHLD)
 | 
			
		||||
	signal.Notify(signals, unix.SIGTERM, unix.SIGINT, unix.SIGCHLD, unix.SIGPIPE)
 | 
			
		||||
	// make sure runc is setup to use the monitor
 | 
			
		||||
	// for waiting on processes
 | 
			
		||||
	runc.Monitor = reaper.Default
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user