Files
thanks/internal/executor/ssh.go

22 lines
484 B
Go

package executor
import (
"context"
"os/exec"
)
type SSHExecutor struct {
SSHTarget string
}
func (s SSHExecutor) CombinedOutput(ctx context.Context, name string, arg ...string) ([]byte, error) {
return s.CommandContext(ctx, name, arg...).CombinedOutput()
}
func (s SSHExecutor) CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd {
newArg := append([]string{s.SSHTarget, name}, arg...)
cmd := exec.CommandContext(ctx, "ssh", newArg...)
return cmd
}