1
0
mirror of https://github.com/rancher/os.git synced 2025-04-27 19:15:23 +00:00

Stop docker and console first to avoid zombie processes

This commit is contained in:
niusmallnan 2018-11-26 18:17:07 +08:00 committed by niusmallnan
parent 3c998bef45
commit cf3535458e

View File

@ -25,6 +25,14 @@ func switchConsoleAction(c *cli.Context) error {
return err
}
// stop docker and console to avoid zombie process
if err = project.Stop(context.Background(), 10, "docker"); err != nil {
log.Errorf("Failed to stop Docker: %v", err)
}
if err = project.Stop(context.Background(), 10, "console"); err != nil {
log.Errorf("Failed to stop console: %v", err)
}
if newConsole != "default" {
if err = compose.LoadSpecialService(project, cfg, "console", newConsole); err != nil {
return err
@ -41,8 +49,8 @@ func switchConsoleAction(c *cli.Context) error {
return err
}
if err = project.Restart(context.Background(), 10, "docker"); err != nil {
log.Errorf("Failed to restart Docker: %v", err)
if err = project.Start(context.Background(), "docker"); err != nil {
log.Errorf("Failed to start Docker: %v", err)
}
return nil