func (a *Agent) Add(key []byte) error {
	if a.pid == 0 || a.sock == "" {
		return errors.New("Agent must Run() before Add()")
	}
	cmd := exec.Command("ssh-add", "-")
	key = append(key, '\n')
	cmd.Stdin = bytes.NewReader(key)
	cmd.Env = []string{
		"SSH_AGENT_PID=" + strconv.Itoa(a.pid),
		"SSH_AUTH_SOCK=" + a.sock,
		"SSH_ASKPASS=/bin/false",
	}
	return cmd.Run()
}
Add wraps `ssh-agent add`
package sshagent
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"os"
	"os/exec"
	"regexp"
	"strconv"
)
const (
	envPID  = "SSH_AGENT_PID"
	envSock = "SSH_AUTH_SOCK"
)
var (
	regexpSock = regexp.MustCompile("(?m)^SSH_AUTH_SOCK=(.*); export SSH_AUTH_SOCK;$")
	regexpPid  = regexp.MustCompile("(?m)^SSH_AGENT_PID=(.*); export SSH_AGENT_PID;$")
)
type Agent struct {
	pid  int
	sock string
	out  []byte
}
func (a *Agent) Run() (bool, error) {
	if a.pid != 0 && a.sock != "" {
		return false, nil
	}
	if s, p := os.Getenv(envSock), os.Getenv(envPID); s != "" && p != "" {
		pid, err := strconv.ParseInt(p, 10, 32)
		if err != nil {
			return false, fmt.Errorf("%s: %w", envPID, err)
		}
		a.sock = s
		a.pid = int(pid)
		return false, nil
	}
	cmd := exec.Command("ssh-agent", "-s")
	stdout, err := cmd.Output()
	if err != nil {
		return false, fmt.Errorf("running ssh-agent: %w", err)
	}
	sock, err := parseOutputSock(string(stdout))
	if err != nil {
		return false, err
	}
	pid, err := parseOutputPid(string(stdout))
	if err != nil {
		return false, err
	}
	a.out = stdout
	a.sock = sock
	a.pid = pid
	return true, nil
}