(ctx context.Context, session *ssh.Session, cmd string)
| 350 | } |
| 351 | |
| 352 | func runSessionWithContext(ctx context.Context, session *ssh.Session, cmd string) error { |
| 353 | errCh := make(chan error, 1) |
| 354 | |
| 355 | go func() { |
| 356 | errCh <- session.Run(cmd) |
| 357 | }() |
| 358 | |
| 359 | select { |
| 360 | case <-ctx.Done(): |
| 361 | session.Close() |
| 362 | return ctx.Err() |
| 363 | case err := <-errCh: |
| 364 | return err |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | func (conn *SSHConn) getEnvironmentNoPty(ctx context.Context, client *ssh.Client) (map[string]string, error) { |
| 369 | session, err := client.NewSession() |
no test coverage detected