Files
public/myssh/myssh_test.go
2021-01-29 13:41:12 +08:00

26 lines
393 B
Go

package myssh
import (
"fmt"
"testing"
"time"
)
func TestMain(t *testing.T) {
c, err := New("127.0.0.1", "ubuntu", "qwer", 22)
if err != nil {
fmt.Println("err", err)
}
output, err := c.Run("ls")
fmt.Printf("%v\n%v", output, err) // 返回字符串
time.Sleep(1 * time.Second)
// c.RunTerminal("top") 交互式
// time.Sleep(1 * time.Second)
c.EnterTerminal() // 进入
}