themattrix / bash-concurrent

Bash function to run tasks in parallel and display pretty output as they complete.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gracefully handle running without a tty.

themattrix opened this issue · comments

Interactive output can be disabled by manually setting CONCURRENT_DEPTH to 0 or higher. Unfortunately this still requires the TERM environment variable to be valid so that the call to tput succeeds (when checking the number of terminal columns).

It's also non-intuitive and undocumented.

A better solution would be to automatically determine if the output is not connected to a tty and gracefully disable interactive output.

Acceptance Criteria:

  • When run without a tty, interactive output is disabled.
  • When run without a tty, colors are disabled.
  • When run without a tty, TERM can be unset.
  • When run without a tty, each task line is displayed as soon as it completes.