Track a verified background forward, cleaning it up if PID-file persistence fails.
(
name: &str,
port: u16,
pid: u32,
sandbox_id: &str,
bind_addr: &str,
cleanup: impl FnOnce(),
)
| 496 | |
| 497 | /// Track a verified background forward, cleaning it up if PID-file persistence fails. |
| 498 | fn track_background_forward_or_cleanup( |
| 499 | name: &str, |
| 500 | port: u16, |
| 501 | pid: u32, |
| 502 | sandbox_id: &str, |
| 503 | bind_addr: &str, |
| 504 | cleanup: impl FnOnce(), |
| 505 | ) -> Result<()> { |
| 506 | if let Err(err) = write_forward_pid(name, port, pid, sandbox_id, bind_addr) { |
| 507 | cleanup(); |
| 508 | return Err(err) |
| 509 | .wrap_err("local forward listener was reachable but tracking the SSH process failed"); |
| 510 | } |
| 511 | Ok(()) |
| 512 | } |
| 513 | |
| 514 | fn foreground_forward_started_message(name: &str, spec: &ForwardSpec) -> String { |
| 515 | format!( |
no test coverage detected