Skip to main content

console-retry

This utility is designed to run any shell command and retry if no new line was written to stdout within a specified timeout. Especially useful in CI to retry flaky tests/scripts

The default timeout applies to lines written to stdout of the shell command.

Retry is triggered when:

  • No new line was written to stdout after specified timeout

Retry is not triggered when:

  • The command as a whole takes longer than specified timeout
  • The command returns a non-zero (error) return code

To be a good bash-citizen the return code is mirrors the return code of the subcommand or 1 if the command never finished in the specified timeout.

Example use / tests

console-retry -t 10 "echo abcd ; false" # Immediate fail
console-retry -r 1 "sleep 70" # Fail after default timeout = 60
console-retry -s -r 1 -t 10 "sleep 15" # Should "skip timeout and therefore succeed after 15s"
console-retry -t 10 "echo abcd ; true" # Immediate success
console-retry -p -o abcd -t 10 " sleep 5; echo abc ;sleep 20; false" # Should Complete with error on second try
console-retry -o abcd -t 10 " sleep 5; echo abc ;sleep 20; false" # Should fail after retrymax (no progressive)
console-retry -o abc -t 10 " sleep 5; echo abc ; false"           # Should retry max but never with ok
console-retry -o abc -t 10 ">&2 echo abc ; false"                 # stderr, should retry max
console-retry -o nomatch -t 10 ">&2 echo abc ; false"             # stderr, should fail immediately
console-retry -o abc -t 10 "echo abc ; true"                      # stderr, should succeed immediately
console-retry -o nomatch -t 10 ">&2 echo abc ; sleep 2; echo def; true"  # Output should be: abc \ndef
console-retry -t 10 ">&2 echo abc ; sleep 10; echo def; sleep 10; true" # Staggered output 

Metadata

Release files for console-retry 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for console-retry 1.0.4
File Size Uploaded
console_retry-1.0.4.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for console-retry 1.0.4
File Interpreter ABI Platform
console_retry-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / console_retry-1.0.4.tar.gz

Download URL console_retry-1.0.4.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8f54b4dc9cee80149060a26856f3c93ed019cdc98d8499570bb65c8f66f18ac3
BLAKE2b-256 checksum
How to use checksums
a921b2628efb215e7d2aaf8ad1b63a36c26b8525a69dacff177748a7ce96280f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release files / console_retry-1.0.4-py3-none-any.whl

Download URL console_retry-1.0.4-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c16e75e517aa6773dbc0e98b8aa642ec43044f865f68de129b5c8becf3aac787
BLAKE2b-256 checksum
How to use checksums
7e1df441462a870ddcb69bd96733eed74891866f7718a68fac58f3aa0eb744aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page