Skip to content

Commit

Permalink
fix(ssh): emulate pty on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Mar 8, 2024
1 parent 0e77ee9 commit d54c6de
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"
"os"
"runtime"
"strconv"
"time"

Expand Down Expand Up @@ -85,14 +86,19 @@ func NewSSHServer(ctx context.Context) (*SSHServer, error) {
),
}

s.srv, err = wish.NewServer(
opts := []ssh.Option{
ssh.PublicKeyAuth(s.PublicKeyHandler),
ssh.KeyboardInteractiveAuth(s.KeyboardInteractiveHandler),
ssh.AllocatePty(),
wish.WithAddress(cfg.SSH.ListenAddr),
wish.WithHostKeyPath(cfg.SSH.KeyPath),
wish.WithMiddleware(mw...),
)
}
if runtime.GOOS == "windows" {
opts = append(opts, ssh.EmulatePty())
} else {
opts = append(opts, ssh.AllocatePty())
}
s.srv, err = wish.NewServer(opts...)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d54c6de

Please sign in to comment.