fix context cause propagation

This commit is contained in:
Kenneth Jenkins 2025-03-21 11:36:38 -07:00
parent dbbb6f8091
commit 0ae4742dd0
2 changed files with 6 additions and 0 deletions

View file

@ -172,6 +172,11 @@ func (h *sshUpstream) Run(ctx context.Context) error {
for {
conn, err := listener.Accept()
if err != nil {
// The testenv cleanup expects this function to return a "test cleanup" error,
// which propagates via the context.
if ctx.Err() != nil {
return context.Cause(ctx)
}
return err
}
go h.handleConnection(ctx, conn)