| Crates.io | nuewframe-timeout |
| lib.rs | nuewframe-timeout |
| version | 1.0.0 |
| created_at | 2025-11-21 00:45:11.975742+00 |
| updated_at | 2025-11-21 00:45:11.975742+00 |
| description | A CLI tool to manage timeout duration of a provided command. |
| homepage | |
| repository | https://github.com/nuewframe/timeout |
| max_upload_size | |
| id | 1942834 |
| size | 70,345 |
timeout - A Timeout Command-Line (CLI) Tooltimeout is a simple, cross-platform CLI tool written in Rust that runs any command with a specified timeout. If the
command does not finish before the timeout expires, timeout attempts to terminate it gracefully, then forcefully kills it
if needed.
Why choose timeout over existing timeout tools?
timeout offers:
curl -fsSL https://raw.githubusercontent.com/nuewframe/timeout/main/install.sh | bash
This will download the latest release binary and install it to ~/.local/bin. Make sure this directory is in your PATH.
irm https://raw.githubusercontent.com/nuewframe/timeout/main/install.ps1 | iex
This will download the latest release binary and install it to %LOCALAPPDATA%\Programs\timeout, automatically adding it to your PATH.
Download the latest release for your platform from the Releases page, then place the binary in your system PATH.
cargo install nuewframe-timeout
The binary will be installed as timeout in your Cargo bin directory.
git clone https://github.com/nuewframe/timeout.git
cd timeout
cargo build --release
# Binary will be in target/release/timeout
Basic usage:
timeout 30s -- cargo test --package test_package --test test_case
Examples:
Run a command with a 10-second timeout:
timeout 10s -- ./long_running_script.sh
Evaluate arithmetic or shell expansions (GNU-compatible):
timeout 1s -- sh -c 'echo $((2 + 2))'
timeoutintentionally mirrors GNU timeout: expressions are evaluated by your shell, not by the CLI itself. Wrap the payload insh -c(orcmd /Con Windows) when you need arithmetic or globbing support.
Customize the graceful signal and kill-after window:
timeout -s INT -k 250ms 1s -- sh -c 'trap "echo got-int" INT; sleep 5'
-saccepts Unix signal names or numbers, while-kcontrols how longtimeoutwaits before escalating toSIGKILL. Use-k 0to skip the grace period.
Adjust verbosity:
timeout --quiet 5s -- sleep 10 # fully silent diagnostics
timeout --verbose 5s -- cargo test # emit start/timeout details
Show version:
timeout --version
Flags:
-V, --version Show version
-h, --help Print help
-v, --verbose Print detailed diagnostics (overrides --quiet)
-q, --quiet Suppress timeout diagnostics
-s, --signal <SIG> Unix: send SIG (name or number) before escalating to SIGKILL
-k, --kill-after <D> Grace period before SIGKILL (default 5s, use 0 for immediate)
Common signals used with --signal / -s on Unix-like systems:
| Signal | Number | Description |
|---|---|---|
HUP |
1 | Hangup (reload configuration) |
INT |
2 | Interrupt (Ctrl+C) |
QUIT |
3 | Quit (Ctrl+) |
KILL |
9 | Force Kill (cannot be caught) |
TERM |
15 | Termination (default) |
USR1 |
10/30* | User-defined signal 1 |
USR2 |
12/31* | User-defined signal 2 |
* Numbers for
USR1/USR2vary by architecture/OS.
For a complete list, see man7.org: signal(7).
While timeout works natively on Windows, the operating system does not support POSIX-style signals (like SIGTERM or SIGINT).
--signal / -s flag is ignored on Windows. Windows uses Console Control Events (CTRL_C_EVENT, CTRL_BREAK_EVENT) which behave differently.timeout attempts a graceful termination where possible, but often defaults to a forced kill (similar to TerminateProcess) after the grace period.timeout attempts to kill the entire process tree using Job Objects where applicable.For more details on Windows process control:
timeout can be integrated into:
For Docker environments:
FROM rust:latest
RUN cargo install nuewframe-timeout
ENTRYPOINT ["timeout"]
For CI usage (GitHub Actions example):
- name: Install timeout
run: cargo install nuewframe-timeout
- name: Run tests with timeout
run: timeout 5m -- cargo test
See ROADMAP.md for detailed development roadmap.
MIT License. See LICENSE for details.