mirror of
https://github.com/apricote/hcloud-upload-image.git
synced 2026-02-06 17:57:06 +00:00
feat: initial library code
This commit is contained in:
parent
b331ddba81
commit
4f57df5b66
10 changed files with 575 additions and 0 deletions
12
util/sshsession/session.go
Normal file
12
util/sshsession/session.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package sshsession
|
||||
|
||||
import "golang.org/x/crypto/ssh"
|
||||
|
||||
func Run(client *ssh.Client, cmd string) ([]byte, error) {
|
||||
sess, err := client.NewSession()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer sess.Close()
|
||||
return sess.CombinedOutput(cmd)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue