@@ -95,7 +95,7 @@ type ContainerMgr interface {
9595 // Remove removes a container, it may be running or stopped and so on.
9696 Remove (ctx context.Context , name string , option * types.ContainerRemoveOptions ) error
9797
98- // 2. The following five functions is related to containr exec.
98+ // 2. The following five functions is related to container exec.
9999
100100 // CreateExec creates exec process's environment.
101101 CreateExec (ctx context.Context , name string , config * types.ExecCreateConfig ) (string , error )
@@ -1674,16 +1674,6 @@ func (mgr *ContainerManager) exitedAndRelease(id string, m *ctrd.Message) error
16741674// execExitedAndRelease be register into ctrd as a callback function, when the exec process in a container
16751675// exited, "ctrd" will call it to release resource and so on.
16761676func (mgr * ContainerManager ) execExitedAndRelease (id string , m * ctrd.Message ) error {
1677- if io := mgr .IOs .Get (id ); io != nil {
1678- if err := m .RawError (); err != nil {
1679- fmt .Fprintf (io .Stdout , "%v\n " , err )
1680- }
1681-
1682- // close io
1683- io .Close ()
1684- mgr .IOs .Remove (id )
1685- }
1686-
16871677 v , ok := mgr .ExecProcesses .Get (id ).Result ()
16881678 if ! ok {
16891679 return errors .Wrap (errtypes .ErrNotfound , "to be exec process: " + id )
@@ -1696,7 +1686,16 @@ func (mgr *ContainerManager) execExitedAndRelease(id string, m *ctrd.Message) er
16961686 execConfig .Running = false
16971687 execConfig .Error = m .RawError ()
16981688
1699- // TODO: GC invalid mgr.ExecProcess.
1689+ if io := mgr .IOs .Get (id ); io != nil {
1690+ if err := m .RawError (); err != nil {
1691+ fmt .Fprintf (io .Stdout , "%v\n " , err )
1692+ }
1693+
1694+ // close io
1695+ io .Close ()
1696+ mgr .IOs .Remove (id )
1697+ }
1698+
17001699 return nil
17011700}
17021701
0 commit comments