8af44dfcd2
A fast, read-only ~/.ssh/config picker that exec's the system ssh client. Includes: static high-contrast picker with recency/frequency/name sort and tag grouping, `dial keygen` (native ed25519/RSA + optional config entry), and an optional offline YubiKey launch gate with one-time recovery codes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
767 B
Go
34 lines
767 B
Go
//go:build windows
|
|
|
|
package connect
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"os/exec"
|
|
)
|
|
|
|
// execCommand runs the target as a child with inherited stdio because Windows
|
|
// has no execve-style process replacement. dial waits and then exits with the
|
|
// child's status, so from the user's perspective control still passes cleanly
|
|
// to ssh.exe (found on PATH; typically %WINDIR%\System32\OpenSSH).
|
|
func execCommand(c Command) error {
|
|
path, err := exec.LookPath(c.Bin)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
cmd := exec.Command(path, c.Args...)
|
|
cmd.Stdin = os.Stdin
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
if err := cmd.Run(); err != nil {
|
|
var ee *exec.ExitError
|
|
if errors.As(err, &ee) {
|
|
os.Exit(ee.ExitCode())
|
|
}
|
|
return err
|
|
}
|
|
os.Exit(0)
|
|
return nil // unreachable
|
|
}
|