Skip to content

Commit

Permalink
ssh修改
Browse files Browse the repository at this point in the history
  • Loading branch information
MrYZhou committed Jan 4, 2023
1 parent 926bfb0 commit 3caa618
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ssh/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"path"
"strings"

. "github.com/MrYZhou/outil/file"
"github.com/pkg/sftp"
"golang.org/x/crypto/ssh"
. "github.com/MrYZhou/outil/file"
)

// 连接信息
Expand Down Expand Up @@ -56,8 +56,8 @@ func (c Cli) Run(shell string) (string, error) {

r, err := session.StdoutPipe()
if err != nil {
fmt.Println(err)
os.Exit(1001)
fmt.Println(err)
os.Exit(1001)
}
go io.Copy(os.Stdout, r)

Expand All @@ -66,15 +66,17 @@ func (c Cli) Run(shell string) (string, error) {
return c.LastResult, err
}

func Server(host string, user string, password string) Cli {
func Server(host string, user string, password string) *Cli {

cli := Cli{
host: host,
user: user,
password: password,
sftpClient: nil,
client: nil,
}
cli.Connect()
return cli
c, _ := cli.Connect()
return c
}

// 创建目录
Expand Down

0 comments on commit 3caa618

Please sign in to comment.