Wait for the local listener, racing the probe against the `ssh` child exiting. An early exit (e.g. `ExitOnForwardFailure=yes` tearing down the session) means forwarding never came up, so it errors instead of waiting out the grace period.
(child: &mut Child, spec: &ForwardSpec)
| 408 | /// session) means forwarding never came up, so it errors instead of waiting |
| 409 | /// out the grace period. |
| 410 | async fn wait_for_forward_start(child: &mut Child, spec: &ForwardSpec) -> Result<()> { |
| 411 | let listener = wait_for_forward_listener(spec, FORWARD_LISTENER_READINESS_TIMEOUT); |
| 412 | tokio::pin!(listener); |
| 413 | tokio::select! { |
| 414 | result = &mut listener => result, |
| 415 | status = child.wait() => { |
| 416 | let status = status.into_diagnostic()?; |
| 417 | if status.success() { |
| 418 | Err(miette::miette!( |
| 419 | "ssh exited before local forward listener opened on {}:{}", |
| 420 | forward_probe_host(spec), |
| 421 | spec.port, |
| 422 | )) |
| 423 | } else { |
| 424 | Err(miette::miette!( |
| 425 | "ssh exited with status {status} before local forward listener opened on {}:{}", |
| 426 | forward_probe_host(spec), |
| 427 | spec.port, |
| 428 | )) |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /// Poll the local endpoint until a connect succeeds or `wait_for` elapses. The |
| 435 | /// last probe error is folded into the timeout diagnostic, so a failure reports |
no test coverage detected