Browse Source

Don't forward SIGPIPE from client to container

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Brian Goff 9 years ago
parent
commit
81707de23f
3 changed files with 4 additions and 1 deletions
  1. 1 1
      api/client/start.go
  2. 2 0
      pkg/signal/signal_unix.go
  3. 1 0
      pkg/signal/signal_windows.go

+ 1 - 1
api/client/start.go

@@ -21,7 +21,7 @@ func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
 	signal.CatchAll(sigc)
 	signal.CatchAll(sigc)
 	go func() {
 	go func() {
 		for s := range sigc {
 		for s := range sigc {
-			if s == signal.SIGCHLD {
+			if s == signal.SIGCHLD || s == signal.SIGPIPE {
 				continue
 				continue
 			}
 			}
 			var sig string
 			var sig string

+ 2 - 0
pkg/signal/signal_unix.go

@@ -14,6 +14,8 @@ const (
 	SIGCHLD = syscall.SIGCHLD
 	SIGCHLD = syscall.SIGCHLD
 	// SIGWINCH is a signal sent to a process when its controlling terminal changes its size
 	// SIGWINCH is a signal sent to a process when its controlling terminal changes its size
 	SIGWINCH = syscall.SIGWINCH
 	SIGWINCH = syscall.SIGWINCH
+	// SIGPIPE is a signal sent to a process when a pipe is written to before the other end is open for reading
+	SIGPIPE = syscall.SIGPIPE
 	// DefaultStopSignal is the syscall signal used to stop a container in unix systems.
 	// DefaultStopSignal is the syscall signal used to stop a container in unix systems.
 	DefaultStopSignal = "SIGTERM"
 	DefaultStopSignal = "SIGTERM"
 )
 )

+ 1 - 0
pkg/signal/signal_windows.go

@@ -11,6 +11,7 @@ import (
 const (
 const (
 	SIGCHLD  = syscall.Signal(0xff)
 	SIGCHLD  = syscall.Signal(0xff)
 	SIGWINCH = syscall.Signal(0xff)
 	SIGWINCH = syscall.Signal(0xff)
+	SIGPIPE  = syscall.Signal(0xff)
 	// DefaultStopSignal is the syscall signal used to stop a container in windows systems.
 	// DefaultStopSignal is the syscall signal used to stop a container in windows systems.
 	DefaultStopSignal = "15"
 	DefaultStopSignal = "15"
 )
 )