Crate try

Crate try 

Source
Expand description

Re-run a command until success (ok) or failure (ko) with cooldown.

§Arguments

  • cooldown_secs Seconds to sleep between tries.
  • exit_condition ok (stop on success) or ko (stop on failure).
  • command... Remainder joined and executed via sh -c.

§Usage

try 2 ok cargo test # rerun every 2s until tests pass
try 5 ko curl -f localhost:8080 # rerun until it fails (e.g. service goes down)

§Errors

  • Cooldown seconds parse fails.
  • Exit condition parse fails.
  • Spawning or executing command fails.
  • UTF-8 conversion for output or error context fails.

Enums§

ExitCond 🔒
Exit condition for retry loop.

Functions§

main 🔒
Re-run a command until success (ok) or failure (ko) with cooldown.