From e215b9970ad82915a8d544b81b3c49d7d84a0eb0 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Wed, 3 Oct 2018 10:31:01 -0700 Subject: runsc: Pass root container's stdio via FD. We were previously using the sandbox process's stdio as the root container's stdio. This makes it difficult/impossible to distinguish output application output from sandbox output, such as panics, which are always written to stderr. Also close the console socket when we are done with it. PiperOrigin-RevId: 215585180 Change-Id: I980b8c69bd61a8b8e0a496fd7bc90a06446764e0 --- runsc/console/console.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runsc/console/console.go') diff --git a/runsc/console/console.go b/runsc/console/console.go index 2f2745b2b..3df184742 100644 --- a/runsc/console/console.go +++ b/runsc/console/console.go @@ -40,6 +40,7 @@ func NewWithSocket(socketPath string) (*os.File, error) { ptySlave.Close() return nil, fmt.Errorf("error dial socket %q: %v", socketPath, err) } + defer conn.Close() uc, ok := conn.(*net.UnixConn) if !ok { ptySlave.Close() @@ -50,6 +51,7 @@ func NewWithSocket(socketPath string) (*os.File, error) { ptySlave.Close() return nil, fmt.Errorf("error getting file for unix socket %v: %v", uc, err) } + defer socket.Close() // Send the master FD over the connection. msg := unix.UnixRights(int(ptyMaster.Fd())) -- cgit v1.2.3