//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 }