Merge pull request #735 from crosbymichael/socket-unpack

Only set socket on non-nil type creation
This commit is contained in:
Phil Estes 2017-04-13 13:58:12 -04:00 committed by GitHub
commit 07b5bca43c
2 changed files with 12 additions and 9 deletions

View File

@ -59,12 +59,13 @@ func newExecProcess(context context.Context, path string, r *shimapi.ExecRequest
e.io = io e.io = io
} }
opts := &runc.ExecOpts{ opts := &runc.ExecOpts{
PidFile: pidfile, PidFile: pidfile,
ConsoleSocket: socket, IO: io,
IO: io, Detach: true,
Detach: true, }
if socket != nil {
opts.ConsoleSocket = socket
} }
// process exec request // process exec request
var spec specs.Process var spec specs.Process
if err := json.Unmarshal(r.Spec.Value, &spec); err != nil { if err := json.Unmarshal(r.Spec.Value, &spec); err != nil {

View File

@ -73,10 +73,12 @@ func newInitProcess(context context.Context, path string, r *shimapi.CreateReque
p.io = io p.io = io
} }
opts := &runc.CreateOpts{ opts := &runc.CreateOpts{
PidFile: filepath.Join(path, "init.pid"), PidFile: filepath.Join(path, "init.pid"),
ConsoleSocket: socket, IO: io,
IO: io, NoPivot: r.NoPivot,
NoPivot: r.NoPivot, }
if socket != nil {
opts.ConsoleSocket = socket
} }
if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil { if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil {
return nil, err return nil, err