add PTY handler
This commit is contained in:
9
main.go
9
main.go
@@ -225,6 +225,15 @@ func main() {
|
||||
}
|
||||
|
||||
func teaHandler(s ssh.Session) (tea.Model, []tea.ProgramOption) {
|
||||
// Check if PTY is available
|
||||
ptyReq, _, _ := s.Pty()
|
||||
if ptyReq.Term == "" {
|
||||
// No PTY, handle as command execution
|
||||
s.Write([]byte("This server requires an interactive terminal (PTY).\nPlease connect with: ssh -t user@host\n"))
|
||||
s.Exit(1)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return model{
|
||||
showWelcome: true,
|
||||
focus: 0,
|
||||
|
||||
Reference in New Issue
Block a user