mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Convert exec session tracking to use a dedicated struct
This will behave better if we need to add anything to it at a later date - we can add fields to the struct without breaking existing BoltDB databases. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #412 Approved by: baude
This commit is contained in:
@ -307,9 +307,13 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
|
||||
|
||||
// We have the PID, add it to state
|
||||
if c.state.ExecSessions == nil {
|
||||
c.state.ExecSessions = make(map[string]int)
|
||||
c.state.ExecSessions = make(map[string]*ExecSession)
|
||||
}
|
||||
c.state.ExecSessions[sessionID] = int(pid)
|
||||
session := new(ExecSession)
|
||||
session.ID = sessionID
|
||||
session.Command = cmd
|
||||
session.PID = int(pid)
|
||||
c.state.ExecSessions[sessionID] = session
|
||||
if err := c.save(); err != nil {
|
||||
// Now we have a PID but we can't save it in the DB
|
||||
// TODO handle this better
|
||||
|
Reference in New Issue
Block a user