fix: 解决容器终端连接失败的问题

This commit is contained in:
ssongliu
2023-02-24 18:49:34 +08:00
committed by ssongliu
parent 95a5db141f
commit b7324d14dc
12 changed files with 69 additions and 255 deletions

View File

@@ -1,7 +1,6 @@
package terminal
import (
"fmt"
"os"
"os/exec"
"syscall"
@@ -27,8 +26,8 @@ type LocalCommand struct {
ptyClosed chan struct{}
}
func NewCommand(containerName string, auth string) (*LocalCommand, error) {
cmd := exec.Command("sh", "-c", fmt.Sprintf("docker exec -it %s redis-cli %s", containerName, auth))
func NewCommand(commands string) (*LocalCommand, error) {
cmd := exec.Command("sh", "-c", commands)
pty, err := pty.Start(cmd)
if err != nil {