| Crates.io | standby |
| lib.rs | standby |
| version | 0.2.0 |
| created_at | 2025-11-08 16:12:20.901966+00 |
| updated_at | 2026-01-05 21:46:50.904934+00 |
| description | A world-class cross-platform time management tool for sleep, timeout, and wait operations with full POSIX compliance and GNU coreutils compatibility |
| homepage | https://github.com/epistates/standby |
| repository | https://github.com/epistates/standby |
| max_upload_size | |
| id | 1923011 |
| size | 112,491 |
A comprehensive, production-ready Rust CLI tool for time management across all platforms. Standby provides a unified interface for sleep, timeout, wait, and delay operations with full POSIX compliance and GNU coreutils compatibility.
Universal Time Format Parser: Flexible parsing of time durations
55.51s, 1m, 1h, 1d1h30m45sinfinityCross-Platform Support: Works seamlessly on Unix/Linux, macOS, and Windows
Three Core Commands:
cargo build --release
The binary will be at target/release/standby.
# Basic usage (5 seconds)
standby sleep 5
# Various time formats
standby sleep 5s # 5 seconds
standby sleep 0.5s # 500 milliseconds
standby sleep 1m # 1 minute
standby sleep 1m30s # 1 minute 30 seconds
standby sleep 1h # 1 hour
standby sleep 1d # 1 day
standby sleep infinity # Sleep forever
# Run a command with a 10-second timeout
standby timeout 10 sleep 60
# Using signal options
standby timeout -s TERM 10 sleep 60 # Send SIGTERM on timeout
standby timeout -s KILL 10 sleep 60 # Send SIGKILL on timeout
# Signal escalation: send SIGTERM, then SIGKILL after 2 seconds
standby timeout -k 2s 10 sleep 60
# Preserve exit status of the command
standby timeout --preserve-status 10 sleep 60
# Run in foreground process group (like GNU timeout --foreground)
standby timeout --foreground 10 vim myfile.txt
# Enable verbose debugging (shows timing, PIDs, signal details)
standby timeout -v 10 sleep 60
standby timeout --verbose 10 sleep 60
Advanced Terminal Handling:
Standby's timeout command includes world-class terminal state restoration:
reset or tput cnorm after timeoutprocess_group() API instead of unsafe pre_execSignal Support:
Supported signals vary by platform. Use -s TERM, -s KILL, -s INT, -s STOP, -s CONT, -s TSTP, or -s HUP:
| Signal | Number | Linux/macOS | Windows | Purpose |
|---|---|---|---|---|
| TERM | 15 | ✅ | ⚠️ | Graceful termination request |
| KILL | 9 | ✅ | ✅ | Forceful termination (cannot be caught) |
| INT | 2 | ✅ | ⚠️ | Interrupt signal (Ctrl+C) |
| STOP | 19 | ✅ | ❌ | Pause process (cannot be caught) |
| CONT | 18 | ✅ | ❌ | Resume paused process |
| TSTP | 20 | ✅ | ❌ | Terminal stop (like Ctrl+Z, can be caught) |
| HUP | 1 | ✅ | ❌ | Hangup signal (terminal closed) |
Platform Notes:
--kill-after 0 for immediate forceful termination-s TERM and specify --kill-after timeout# Wait for a process to complete
standby wait 1234
# Wait for multiple processes
standby wait 1234 5678 9012
# Wait with timeout
standby wait --timeout 30s 1234
# Generate bash completion script
standby completions bash > ~/.bash_completion.d/standby
# Generate zsh completion script
standby completions zsh > ~/.zsh/completions/_standby
# Generate fish completion script
standby completions fish > ~/.config/fish/completions/standby.fish
# Install bash completions (Ubuntu/Debian)
standby completions bash | sudo tee /etc/bash_completion.d/standby
# View bash completion script
standby completions bash
Completion Features:
Run all tests (unit + integration):
cargo test
Run only unit tests:
cargo test --lib
Run only integration tests:
cargo test --test integration_tests
src/
├── main.rs # CLI entry point
├── lib.rs # Library exports
├── errors.rs # Error types
├── terminal.rs # Terminal state management (RAII guard)
├── commands/
│ ├── mod.rs # Command CLI setup
│ ├── sleep.rs # Sleep subcommand
│ ├── timeout.rs # Timeout subcommand
│ └── wait.rs # Wait subcommand
├── time/
│ ├── mod.rs # Time module exports
│ ├── parser.rs # Duration format parser
│ └── duration.rs # Duration type
└── signals/
├── mod.rs # Signal handler abstraction
├── unix.rs # Unix/Linux signal handling (7 signals)
└── windows.rs # Windows signal handling (TerminateProcess)
tests/
└── integration_tests.rs # End-to-end tests
Standby is designed with POSIX compliance as the baseline, with extensions for GNU coreutils compatibility:
20 unit tests covering:
14 integration tests covering:
0: Successful completion1: Timeout occurred or command failedNote: Minimal dependency footprint with no async runtime or external signal handling libraries for synchronous CLI operations.
Standby is compiled to native binaries with optimizations enabled, providing near-native performance with minimal overhead.
-v/--verbose) for timeout troubleshootingMIT or Apache 2.0 (standard Rust project licenses)