Merge pull request #1284 from mlaventure/use-tmp-console-socket

Use a temp socket to receive the console from runc
This commit is contained in:
Michael Crosby 2017-08-04 09:14:22 -04:00 committed by GitHub
commit 0e97bdfea2
2 changed files with 4 additions and 5 deletions

View File

@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"sync"
"syscall"
@ -138,10 +137,10 @@ func (e *execProcess) Start(ctx context.Context) (err error) {
pidfile = filepath.Join(e.path, fmt.Sprintf("%s.pid", e.id))
)
if e.stdio.terminal {
if socket, err = runc.NewConsoleSocket(filepath.Join(e.path, "pty.sock")); err != nil {
if socket, err = runc.NewTempConsoleSocket(); err != nil {
return errors.Wrap(err, "failed to create runc console socket")
}
defer os.Remove(socket.Path())
defer socket.Close()
} else {
if io, err = runc.NewPipeIO(0, 0); err != nil {
return errors.Wrap(err, "failed to create runc io pipes")

View File

@ -117,10 +117,10 @@ func newInitProcess(context context.Context, plat platform, path, namespace stri
io runc.IO
)
if r.Terminal {
if socket, err = runc.NewConsoleSocket(filepath.Join(path, "pty.sock")); err != nil {
if socket, err = runc.NewTempConsoleSocket(); err != nil {
return nil, errors.Wrap(err, "failed to create OCI runtime console socket")
}
defer os.Remove(socket.Path())
defer socket.Close()
} else {
if io, err = runc.NewPipeIO(0, 0); err != nil {
return nil, errors.Wrap(err, "failed to create OCI runtime io pipes")