MCPcopy Index your code
hub / github.com/devspace-sh/devspace / handler

Method handler

helper/ssh/server.go:97–122  ·  view source on GitHub ↗
(sess ssh.Session)

Source from the content-addressed store, hash-verified

95}
96
97func (s *Server) handler(sess ssh.Session) {
98 cmd := s.getCommand(sess)
99 if ssh.AgentRequested(sess) {
100 l, err := ssh.NewAgentListener()
101 if err != nil {
102 exitWithError(sess, errors.Wrap(err, "start agent"))
103 return
104 }
105
106 defer l.Close()
107 go ssh.ForwardAgentConnections(l, sess)
108 cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", "SSH_AUTH_SOCK", l.Addr().String()))
109 }
110
111 // start shell session
112 var err error
113 ptyReq, winCh, isPty := sess.Pty()
114 if isPty {
115 err = HandlePTY(sess, ptyReq, winCh, cmd, nil)
116 } else {
117 err = HandleNonPTY(sess, cmd, nil)
118 }
119
120 // exit session
121 exitWithError(sess, err)
122}
123
124func HandleNonPTY(sess ssh.Session, cmd *exec.Cmd, decorateReader func(reader io.Reader) io.Reader) (err error) {
125 // init pipes

Callers

nothing calls this directly

Calls 7

getCommandMethod · 0.95
exitWithErrorFunction · 0.85
HandlePTYFunction · 0.85
HandleNonPTYFunction · 0.85
AddrMethod · 0.80
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected