mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add err check before getting term
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
This commit is contained in:
parent
1899b2f41a
commit
73bf9b5c19
1 changed files with 7 additions and 2 deletions
|
@ -85,16 +85,21 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||||
dataPath = d.containerDir(c.ID)
|
dataPath = d.containerDir(c.ID)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
container, err := d.createContainer(c)
|
||||||
|
if err != nil {
|
||||||
|
return execdriver.ExitStatus{ExitCode: -1}, err
|
||||||
|
}
|
||||||
|
|
||||||
if c.ProcessConfig.Tty {
|
if c.ProcessConfig.Tty {
|
||||||
term, err = NewTtyConsole(&c.ProcessConfig, pipes)
|
term, err = NewTtyConsole(&c.ProcessConfig, pipes)
|
||||||
} else {
|
} else {
|
||||||
term, err = execdriver.NewStdConsole(&c.ProcessConfig, pipes)
|
term, err = execdriver.NewStdConsole(&c.ProcessConfig, pipes)
|
||||||
}
|
}
|
||||||
c.ProcessConfig.Terminal = term
|
|
||||||
container, err := d.createContainer(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return execdriver.ExitStatus{ExitCode: -1}, err
|
return execdriver.ExitStatus{ExitCode: -1}, err
|
||||||
}
|
}
|
||||||
|
c.ProcessConfig.Terminal = term
|
||||||
|
|
||||||
d.Lock()
|
d.Lock()
|
||||||
d.activeContainers[c.ID] = &activeContainer{
|
d.activeContainers[c.ID] = &activeContainer{
|
||||||
container: container,
|
container: container,
|
||||||
|
|
Loading…
Add table
Reference in a new issue