Exec using API

This commit is contained in:
Stanislav Pavlovichev
2018-10-13 08:33:53 +03:00
parent e68f7ba96a
commit 967a87a65f
7 changed files with 105 additions and 17 deletions

View File

@@ -2,8 +2,6 @@ package main
import (
"fmt"
"os"
"os/exec"
"time"
"github.com/bcicen/ctop/config"
@@ -225,13 +223,7 @@ func ExecSh() MenuFn {
ui.StopLoop()
defer ui.Loop()
// Reset colors && clear screen && run sh
cmdName := fmt.Sprintf("echo '\033[0m' && clear && docker exec -it %s sh", c.GetMeta("name"))
cmd := exec.Command("bash", "-c", cmdName)
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Run()
c.Exec([]string{"sh", "-c", "echo '\033[0m' && clear && sh"})
return nil
}