Merge pull request #27470 from runcom/expose-exec-pid
record pid of exec'd process Upstream-commit: 13fd75c3dd18e6d57b6b28097fd7e0d0989c1b9e Component: engine
This commit is contained in:
@ -212,9 +212,13 @@ func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R
|
||||
|
||||
attachErr := container.AttachStreams(ctx, ec.StreamConfig, ec.OpenStdin, true, ec.Tty, cStdin, cStdout, cStderr, ec.DetachKeys)
|
||||
|
||||
if err := d.containerd.AddProcess(ctx, c.ID, name, p); err != nil {
|
||||
systemPid, err := d.containerd.AddProcess(ctx, c.ID, name, p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ec.Lock()
|
||||
ec.Pid = systemPid
|
||||
ec.Unlock()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
||||
@ -28,6 +28,7 @@ type Config struct {
|
||||
Privileged bool
|
||||
User string
|
||||
Env []string
|
||||
Pid int
|
||||
}
|
||||
|
||||
// NewConfig initializes the a new exec configuration
|
||||
|
||||
@ -209,6 +209,7 @@ func (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, err
|
||||
CanRemove: e.CanRemove,
|
||||
ContainerID: e.ContainerID,
|
||||
DetachKeys: e.DetachKeys,
|
||||
Pid: e.Pid,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user