|
@@ -35,7 +35,7 @@ type execConfig struct {
|
|
|
|
|
|
type execStore struct {
|
|
|
s map[string]*execConfig
|
|
|
- sync.Mutex
|
|
|
+ sync.RWMutex
|
|
|
}
|
|
|
|
|
|
func newExecStore() *execStore {
|
|
@@ -49,9 +49,9 @@ func (e *execStore) Add(id string, execConfig *execConfig) {
|
|
|
}
|
|
|
|
|
|
func (e *execStore) Get(id string) *execConfig {
|
|
|
- e.Lock()
|
|
|
+ e.RLock()
|
|
|
res := e.s[id]
|
|
|
- e.Unlock()
|
|
|
+ e.RUnlock()
|
|
|
return res
|
|
|
}
|
|
|
|
|
@@ -61,6 +61,16 @@ func (e *execStore) Delete(id string) {
|
|
|
e.Unlock()
|
|
|
}
|
|
|
|
|
|
+func (e *execStore) List() []string {
|
|
|
+ var IDs []string
|
|
|
+ e.RLock()
|
|
|
+ for id, _ := range e.s {
|
|
|
+ IDs = append(IDs, id)
|
|
|
+ }
|
|
|
+ e.RUnlock()
|
|
|
+ return IDs
|
|
|
+}
|
|
|
+
|
|
|
func (execConfig *execConfig) Resize(h, w int) error {
|
|
|
return execConfig.ProcessConfig.Terminal.Resize(h, w)
|
|
|
}
|
|
@@ -249,6 +259,10 @@ func (d *Daemon) Exec(c *Container, execConfig *execConfig, pipes *execdriver.Pi
|
|
|
return exitStatus, err
|
|
|
}
|
|
|
|
|
|
+func (container *Container) GetExecIDs() []string {
|
|
|
+ return container.execCommands.List()
|
|
|
+}
|
|
|
+
|
|
|
func (container *Container) Exec(execConfig *execConfig) error {
|
|
|
container.Lock()
|
|
|
defer container.Unlock()
|