(connId connections.ConnectionId)
| 315 | } |
| 316 | |
| 317 | func (m *CLIBridgeModule) makeInputHandler(connId connections.ConnectionId) connections.InputHandler { |
| 318 | return func(ci *connections.ClientInput, handlerState map[string]any) bool { |
| 319 | sess := m.getSession(connId) |
| 320 | if sess == nil { |
| 321 | return true |
| 322 | } |
| 323 | |
| 324 | if len(ci.DataIn) > 0 { |
| 325 | sess.mu.Lock() |
| 326 | if sess.PtyFile != nil { |
| 327 | sess.PtyFile.Write(ci.DataIn) |
| 328 | } |
| 329 | sess.mu.Unlock() |
| 330 | } |
| 331 | |
| 332 | ci.DataIn = ci.DataIn[:0] |
| 333 | ci.Buffer = ci.Buffer[:0] |
| 334 | ci.EnterPressed = false |
| 335 | ci.TabPressed = false |
| 336 | ci.BSPressed = false |
| 337 | |
| 338 | return false |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | func (m *CLIBridgeModule) ptyToClient(sess *Session) { |
| 343 | buf := make([]byte, 4096) |
no test coverage detected